2200
|
How can I delete the selected items (including descendants)
![](images/exg2anttq2200.png)
// KeyDown event - Occurs when the user presses a key while an object has the focus.
procedure TForm1.G2antt1KeyDown(ASender: TObject; var KeyCode : Smallint;Shift : Smallint);
begin
with G2antt1 do
begin
RemoveSelection();
end
end;
with G2antt1 do
begin
BeginUpdate();
SingleSel := False;
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '8/1/2017';
LevelCount := 2;
PaneWidth[False] := 128;
SelBackColor := $f0f0f0;
end;
with Items do
begin
AddBar(AddItem('Task 1'),'Task','8/2/2017','8/6/2017',Null,Null);
h := AddItem('Task 2');
AddBar(h,'Task','8/3/2017','8/9/2017',Null,Null);
SelectItem[h] := True;
h := AddItem('Task 3');
AddBar(h,'Task','8/4/2017','8/13/2017','',Null);
SelectItem[h] := True;
AddBar(AddItem('Task 4'),'Task','8/5/2017','8/16/2017',Null,Null);
end;
EndUpdate();
end
|
2199
|
Dark mode
![](images/exg2anttq2199.png)
with G2antt1 do
begin
BeginUpdate();
back := 65536;
fore := 16777215;
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABXUIQAAYAQGKIcBiAKBQAGYBIJDEMgzDDAUBjKKocQTC4AIQjCK4JDKHYJRpHEZyCA8EhqGASRAFUQBYiWE4oSpLABQaK0ZwIGyRIrkGQgQg' +
'mPYDSDNU4zVIEEglBI0TDNczhNDENgtGYaJqHIYpZBcM40TKkEZoSIITZcRrOEBiRL1S0RBhGcRUHZlWzdN64LhuK47UrWdD/XhdVzXRbjfz1Oq+bxve48Br7A5yYThd' +
'r4LhOFQ3RjIL4xbIcUwGe6VZhjOLZXjmO49T69HTtOCYBEBA');
VisualAppearance.Add(2,'gBFLBCJwBAEHhEJAAEhABPMIQAAYAQGKIcBiAKBQAGaAoDDcMgwQwAAxjIKUEwsACEIrjKCYVgOHYYQjGMZwHCMIhiGwcAChEZYHgkMYmDAMUhSE78axHG6PY7kKZ4bi' +
'aKIqQLLEhSfJ0YyBECBZpfebIbjmIZMSLEIxDKItJSpCIaRgqWS6ahGO4JUbUFLQHT9IR4daIYRgEEBA');
VisualAppearance.Add(3,'gBFLBCJwBAEHhEJAAEhABUUIQAAYAQGKIcBiAKBQAGaAoDDcMgwQwAAxjIKUEwsACEIrjKCYVgOHYYQjGMZwGAsEwjAoYAChEaILgkMw2DBIQwgJIMEr/G6RZxjeL5Cj' +
'mG4nDhKMpybAcXxjBIYZJgOQpXb+PobTrNNLzfRFAxVAaWJikcZ4HpIAJNVLFdQ0XYMNSBISsBqrKiKcpeIIDWBZMbRZT1ZABCIZBpEW6LahENQwXrCN74DYkNTdKaxb' +
'buaaXLhGCYBgIA==');
HeaderAppearance := EXG2ANTTLib_TLB.Bump;
BackColor := back;
BackColorHeader := back;
BackColorLevelHeader := back;
BackColorSortBar := back;
BackColorSortBarCaption := back;
FilterBarBackColor := back;
FilterBarForeColor := fore;
ForeColor := fore;
ForeColorHeader := fore;
ForeColorSortBar := fore;
SelBackColor := fore;
SelForeColor := back;
Background[EXG2ANTTLib_TLB.exHeaderFilterBarButton] := $1000000;
Background[EXG2ANTTLib_TLB.exSplitBar] := $2000000;
Background[EXG2ANTTLib_TLB.exCursorHoverColumn] := $ffffffff;
Background[EXG2ANTTLib_TLB.exToolTipAppearance] := $3000000;
Background[EXG2ANTTLib_TLB.exToolTipBackColor] := back;
Background[EXG2ANTTLib_TLB.exToolTipForeColor] := fore;
Background[EXG2ANTTLib_TLB.exSelBackColorFilter] := fore;
Background[EXG2ANTTLib_TLB.exSelForeColorFilter] := back;
Background[EXG2ANTTLib_TLB.exBackColorFilter] := back;
Background[EXG2ANTTLib_TLB.exForeColorFilter] := fore;
Background[EXG2ANTTLib_TLB.exSortBarLinkColor] := back;
Background[EXG2ANTTLib_TLB.exCSplitBar] := $2000000;
Background[EXG2ANTTLib_TLB.exHSplitBar] := $2000000;
Background[EXG2ANTTLib_TLB.exTreeLinesColor] := fore;
Background[EXG2ANTTLib_TLB.exScrollSizeGrip] := back;
Description[EXG2ANTTLib_TLB.exFilterBarExclude] := '<bgcolor 0><fgcolor ffffff> Exclude </fgcolor></bgcolor>';
with Chart do
begin
BackColor := back;
BackColorLevelHeader := back;
ForeColor := fore;
ForeColorLevelHeader := fore;
end;
EndUpdate();
end
|
2198
|
I have changed the font, but the item's height remains the same. What I am doing wrong
![](images/exg2anttq2198.png)
with G2antt1 do
begin
BeginUpdate();
ColumnAutoResize := False;
LoadXML('http://www.exontrol.net/testing.xml');
Font.Size := 22;
HeaderHeight := 42;
DefaultItemHeight := 36;
Items.ItemHeight[0] := G2antt1.DefaultItemHeight;
Chart.UnitWidth := G2antt1.DefaultItemHeight;
Chart.UnitScale := G2antt1.Chart.UnitScale;
Chart.Bars.Item['Task'].Height := 18;
EndUpdate();
end
|
2197
|
I have changed from Project Summary Task to own task created with EBN to get a black frame then using different colors for project status. How can I enlarge the EBN being applied to the head-arrows shows the start/end margins of the range
![](images/exg2anttq2197.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemBold[Item] := True;
AddBar(Item,CellValue[OleVariant(Item),OleVariant(GroupItem[Item])],'12/2/2017','12/2/2017',Null,Null);
DefineSummaryBars(Item,'',-3,'');
end;
end
end;
// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TForm1.G2antt1AddItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
Items.AddBar(Item,'Task','12/4/2017','12/10/2017',Null,Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
with VisualAppearance do
begin
Add(1,'gBFLBCJwBAEHhEJAAEhABN0GACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSKUOQTDKNYykCQBQAWCQ1DAJIqjOAkEhiGCUQClYYZBjWG4dQLOEYTNC' +
'8WwHCIZBpEWgKChGKAlSANMjTZLkdR1ECmIhoSg4coKMoERBJco1BDdOQGAyEQShEC4fgmVwAP7aNoWVC1JynM6XaKmGbJAA6CZgQKGFh2LAdTzSf61cAtWpaUjmRZaY' +
'SAFDxpiCYpfQjdUB2JDVfTVP6LbawS4KZgOR5eRboETYeAFcSZGrNMKEXLLSyudKRRreWQaPpGCZTRSUdZxSrbBhvEqlbRNMhwSBEEigNIxToOU4jFgeCROQwQRK9BBo' +
'G0CQUEIdhAAyJJvjUeZdmmb5+C8HhiAeZJznoPQ+EgT4rlua4BjCfg+k8d5TkUCZ4w+fxfB+X5xn4fheGebZoH8X53koAR9CASAWAUfofjgJgKH+IJHnGcIDmER5iBEe' +
'ZgmgVgLgGYYYGoFRTCGaIGAYRYiCiFgmgmYQEF4KIKmKSBRBqCxjAiRgvgwYxIiGQYNmOCJlDUOpeAQBCAg=');
Add(2,'CP:1 -6 0 6 0');
end;
with Chart do
begin
LevelCount := 2;
FirstVisibleDate := '12/2/2017';
PaneWidth[False] := 342;
Bars.Add('S1').Color := $1000000;
Bars.Add('S2').Color := $2ff0000;
end;
with Columns do
begin
Add('C1');
(IUnknown(Add('C2')) as EXG2ANTTLib_TLB.Column).AllowSort := False;
end;
SingleSort := False;
AllowGroupBy := True;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
with Items do
begin
CellValue[OleVariant(AddItem('S1')),OleVariant(1)] := 'SubItem A.1';
CellValue[OleVariant(AddItem('S1')),OleVariant(1)] := 'SubItem A.1';
CellValue[OleVariant(AddItem('S2')),OleVariant(1)] := 'SubItem B.1';
CellValue[OleVariant(AddItem('S2')),OleVariant(1)] := 'SubItem B.1';
end;
Layout := 'MultipleSort = "C0:2"';
EndUpdate();
end
|
2196
|
How can I specify the cell's outline, border or lines around, when the cell gets selected
![](images/exg2anttq2196.png)
with G2antt1 do
begin
BeginUpdate();
AttachTemplate('handle AddColumn(Column){Column{Def(48)=4;Def(49)=4;}}');
with VisualAppearance do
begin
Add(1,'gBFLBCJwBAEHhEJAAEhABPEGACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYYLhEZAEiONoaDJCM4wHI' +
'MQxHCKTZRkGcfaRCGSfIzpGKpVgOTYiTbPcIyQKtBxDIydJTmeQQQhsFIJU7SdVUPDUJZlWbLAwWTAYazXCKRZBpeJqdo6Y5RUDKUqSdLUYyvEq7ZqnOIpw5vICpaCqO' +
'p6HqKFpiXSAFL1fLmAwvPKrJjoeqpWpyCaRZQAGg4dbEdTNNCIbatQANKrCSpgZ7sMB6Di2L4TPS2awoWgRYyTFZMbBAeQ7LC1c45Fqrd4zS4dSxKCahcLxFiaNpYZYn' +
'jUap1jGPJlkuAgAkidB3nceZsCQEQJCgGhMGcQ4pkiSxEAAOYpiQIhvkYNA2gSCg5n+LIoGILowFyXQoAYAoAmASAWAaAZgggJgKF2T54DYDoDmECBGBKBJgGgTgWgWY' +
'RoFYGIGmGOBqByB5hCgegggiYJYgoJIICIaIeByChixULILGGGAWDCCgjCiTgrg0YxojoC4OmOSJ2D6D5kAgJLFgABAEICA=');
Add(2,'CP:1 -4 0 0 0');
end;
SelBackColor := $2000000;
SelForeColor := RGB(0,0,1);
FullRowSelect := EXG2ANTTLib_TLB.exColumnSel;
ShowFocusRect := False;
DefaultItemHeight := 24;
HeaderHeight := 24;
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
Columns.Add('C1');
Columns.Add('C2');
with Items do
begin
CellValue[OleVariant(AddItem('Cell 1')),OleVariant(1)] := 'Cell 2';
CellValue[OleVariant(AddItem('Cell 3')),OleVariant(1)] := 'Cell 4';
end;
Items.SelectPos := OleVariant(1);
SelectColumnIndex := 1;
EndUpdate();
end
|
2195
|
How can I specify the cell's outline, border or lines around, when the item gets selected
![](images/exg2anttq2195.png)
with G2antt1 do
begin
BeginUpdate();
AttachTemplate('handle AddColumn(Column){Column{Def(48)=4;Def(49)=4;}}');
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABPEGACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYYLhEZAEiONoaDJCM4wHI' +
'MQxHCKTZRkGcfaRCGSfIzpGKpVgOTYiTbPcIyQKtBxDIydJTmeQQQhsFIJU7SdVUPDUJZlWbLAwWTAYazXCKRZBpeJqdo6Y5RUDKUqSdLUYyvEq7ZqnOIpw5vICpaCqO' +
'p6HqKFpiXSAFL1fLmAwvPKrJjoeqpWpyCaRZQAGg4dbEdTNNCIbatQANKrCSpgZ7sMB6Di2L4TPS2awoWgRYyTFZMbBAeQ7LC1c45Fqrd4zS4dSxKCahcLxFiaNpYZYn' +
'jUap1jGPJlkuAgAkidB3nceZsCQEQJCgGhMGcQ4pkiSxEAAOYpiQIhvkYNA2gSCg5n+LIoGILowFyXQoAYAoAmASAWAaAZgggJgKF2T54DYDoDmECBGBKBJgGgTgWgWY' +
'RoFYGIGmGOBqByB5hCgegggiYJYgoJIICIaIeByChixULILGGGAWDCCgjCiTgrg0YxojoC4OmOSJ2D6D5kAgJLFgABAEICA=');
SelBackColor := $1000000;
SelForeColor := RGB(0,0,1);
ShowFocusRect := False;
DefaultItemHeight := 24;
HeaderHeight := 24;
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
Columns.Add('C1');
Columns.Add('C2');
with Items do
begin
CellValue[OleVariant(AddItem('Cell 1')),OleVariant(1)] := 'Cell 2';
CellValue[OleVariant(AddItem('Cell 3')),OleVariant(1)] := 'Cell 4';
SelectPos := OleVariant(1);
end;
EndUpdate();
end
|
2194
|
How can I specify the cell's outline, border or lines around
![](images/exg2anttq2194.png)
with G2antt1 do
begin
BeginUpdate();
AttachTemplate('handle AddColumn(Column){Column{Def(48)=4;Def(49)=4;}}');
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABPEGACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYYLhEZAEiONoaDJCM4wHI' +
'MQxHCKTZRkGcfaRCGSfIzpGKpVgOTYiTbPcIyQKtBxDIydJTmeQQQhsFIJU7SdVUPDUJZlWbLAwWTAYazXCKRZBpeJqdo6Y5RUDKUqSdLUYyvEq7ZqnOIpw5vICpaCqO' +
'p6HqKFpiXSAFL1fLmAwvPKrJjoeqpWpyCaRZQAGg4dbEdTNNCIbatQANKrCSpgZ7sMB6Di2L4TPS2awoWgRYyTFZMbBAeQ7LC1c45Fqrd4zS4dSxKCahcLxFiaNpYZYn' +
'jUap1jGPJlkuAgAkidB3nceZsCQEQJCgGhMGcQ4pkiSxEAAOYpiQIhvkYNA2gSCg5n+LIoGILowFyXQoAYAoAmASAWAaAZgggJgKF2T54DYDoDmECBGBKBJgGgTgWgWY' +
'RoFYGIGmGOBqByB5hCgegggiYJYgoJIICIaIeByChixULILGGGAWDCCgjCiTgrg0YxojoC4OmOSJ2D6D5kAgJLFgABAEICA=');
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
ShowFocusRect := False;
DefaultItemHeight := 24;
HeaderHeight := 24;
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
Columns.Add('C1');
Columns.Add('C2');
with Items do
begin
CellValue[OleVariant(AddItem('Cell 1')),OleVariant(1)] := 'Cell 2';
h := AddItem('Cell 2');
CellValue[OleVariant(h),OleVariant(1)] := 'Cell 3';
CellBackColor[OleVariant(h),OleVariant(1)] := $1000000;
end;
EndUpdate();
end
|
2193
|
Is it possible to highligth the match while a filter is applied
![](images/exg2anttq2193.png)
// AddColumn event - Fired after a new column has been added.
procedure TForm1.G2antt1AddColumn(ASender: TObject; Column : IColumn);
begin
// Column.Def(17) = 1
end;
// FilterChange event - Occurs when the filter was changed.
procedure TForm1.G2antt1FilterChange(ASender: TObject; );
begin
with G2antt1 do
begin
format := FormatABC('`value replace ''` + value + `'' with ''<bgcolor 000000><fgcolor FFFFFF>` + value + `</fgcolor></bgcolor>''`',OleVariant(FilterBarPromptPattern),Null,Null);
Columns.Item[OleVariant(0)].FormatColumn := format;
Columns.Item[OleVariant(1)].FormatColumn := format;
end
end;
with G2antt1 do
begin
BeginUpdate();
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
Columns.Add('Col 1');
Columns.Add('Col 2');
with Items do
begin
CellValue[OleVariant(AddItem('219 Smith')),OleVariant(1)] := 'Ignacio 1234';
CellValue[OleVariant(AddItem('1666 County Road 309A')),OleVariant(1)] := '897 Manassa';
CellValue[OleVariant(AddItem('38 Lone Pine')),OleVariant(1)] := 'Durango 11';
CellValue[OleVariant(AddItem('612 Jachim Street')),OleVariant(1)] := 'Lamar 222';
end;
FilterBarPromptPattern := '1';
FilterBarPromptVisible := Integer(EXG2ANTTLib_TLB.exFilterBarCompact) Or Integer(EXG2ANTTLib_TLB.exFilterBarSingleLine) Or Integer(EXG2ANTTLib_TLB.exFilterBarVisible) Or Integer(EXG2ANTTLib_TLB.exFilterBarPromptVisible);
FilterBarPromptType := Integer(EXG2ANTTLib_TLB.exFilterPromptCaseSensitive) Or Integer(EXG2ANTTLib_TLB.exFilterPromptContainsAll);
EndUpdate();
end
|
2192
|
How can I display the total/sum/aggregate in the same column, when the user groups by a column
![](images/exg2anttq2192.png)
// AddColumn event - Fired after a new column has been added.
procedure TForm1.G2antt1AddColumn(ASender: TObject; Column : IColumn);
begin
with G2antt1 do
begin
with Column do
begin
end;
end
end;
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemDivider[Item] := -1;
ItemBackColor[Item] := G2antt1.BackColorSortBar;
ItemHeight[Item] := G2antt1.HeaderHeight;
CellMerge[OleVariant(Item),OleVariant(0)] := '1,2,3,4,5,7,8,9,10,11,12';
CellValue[OleVariant(Item),OleVariant(13)] := 'count(current,rec,1)';
CellValueFormat[OleVariant(Item),OleVariant(13)] := Integer(EXG2ANTTLib_TLB.exTotalField) Or Integer(EXG2ANTTLib_TLB.exHTML);
CellValue[OleVariant(Item),OleVariant(0)] := OleVariant(CellCaption[OleVariant(Item),OleVariant(GroupItem[Item])]);
FormatCell[OleVariant(Item),OleVariant(0)] := '`<b>` + value + `</b> <font ;7><off 3><fgcolor=808080>(` + %13 + `)`';
CellValue[OleVariant(Item),OleVariant(6)] := 'sum(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),OleVariant(6)] := Integer(EXG2ANTTLib_TLB.exTotalField) Or Integer(EXG2ANTTLib_TLB.exHTML);
CellForeColor[OleVariant(Item),OleVariant(6)] := $666666;
end;
end
end;
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
Indent := 12;
ColumnAutoResize := False;
ScrollBySingleLine := True;
BackColorSortBar := RGB(240,240,240);
AutoDrag := EXG2ANTTLib_TLB.exAutoDragScroll;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
SortBarVisible := True;
AllowGroupBy := True;
HeaderHeight := 24;
with Columns do
begin
(IUnknown(Add('Count')) as EXG2ANTTLib_TLB.Column).Visible := False;
with Item['Freight'] do
begin
Def[EXG2ANTTLib_TLB.exCellBackColor] := OleVariant(G2antt1.BackColorSortBar);
Def[EXG2ANTTLib_TLB.exHeaderBackColor] := Def[EXG2ANTTLib_TLB.exCellBackColor];
Def[EXG2ANTTLib_TLB.exCellPaddingRight] := OleVariant(4);
Def[EXG2ANTTLib_TLB.exCellPaddingLeft] := OleVariant(4);
HeaderBold := True;
AllowGroupBy := False;
FormatColumn := 'value format ``';
Alignment := EXG2ANTTLib_TLB.RightAlignment;
end;
with Item[OleVariant(0)] do
begin
AllowGroupBy := False;
Def[EXG2ANTTLib_TLB.exCellValueFormat] := OleVariant(1);
end;
Item['ShipCountry'].SortOrder := EXG2ANTTLib_TLB.SortAscending;
end;
ScrollBySingleLine := False;
with Items do
begin
LockedItemCount[EXG2ANTTLib_TLB.exBottom] := 1;
hL := LockedItem[EXG2ANTTLib_TLB.exBottom,0];
ItemHeight[hL] := 24;
ItemBold[hL] := True;
ItemBackColor[hL] := G2antt1.BackColorSortBar;
CellValue[OleVariant(hL),OleVariant(6)] := 'sum(all,rec,dbl(%6))';
CellValueFormat[OleVariant(hL),OleVariant(6)] := Integer(EXG2ANTTLib_TLB.exTotalField) Or Integer(EXG2ANTTLib_TLB.exHTML);
CellHAlignment[OleVariant(hL),OleVariant(6)] := EXG2ANTTLib_TLB.RightAlignment;
FormatCell[OleVariant(hL),OleVariant(6)] := 'value format ``';
end;
EndUpdate();
end
|
2191
|
How do I add a total field locked at the bottom of the control
![](images/exg2anttq2191.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemDividerLine[Item] := EXG2ANTTLib_TLB.EmptyLine;
FormatCell[OleVariant(Item),OleVariant(GroupItem[Item])] := 'value + ` Min: <b>` + %13 + `</b> Max: <b>` + %14 + `</b> Sum: <b>` + %15 + `</b>, of Freight column`';
CellValue[OleVariant(Item),'Min'] := 'min(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Min'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Max'] := 'max(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Max'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Sum'] := 'sum(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Sum'] := EXG2ANTTLib_TLB.exTotalField;
ItemBackColor[Item] := $f0f0f0;
end;
end
end;
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
HasLines := EXG2ANTTLib_TLB.exNoLine;
Description[EXG2ANTTLib_TLB.exColumnsFloatBar] := 'Show/Hide';
ColumnsFloatBarSortOrder := EXG2ANTTLib_TLB.SortAscending;
ColumnsFloatBarVisible := EXG2ANTTLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns;
ColumnAutoResize := False;
BackColorSortBar := RGB(240,240,240);
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
SortBarVisible := True;
AllowGroupBy := True;
SortBarCaption := 'Drag a <b>column</b> header here to group by that column.';
with Columns do
begin
with (IUnknown(Add('Min')) as EXG2ANTTLib_TLB.Column) do
begin
Visible := False;
AllowDragging := False;
end;
var_Column := (IUnknown(Add('Max')) as EXG2ANTTLib_TLB.Column);
with var_Column do
begin
Visible := False;
Visible := False;
AllowDragging := False;
end;
var_Column1 := (IUnknown(Add('Sum')) as EXG2ANTTLib_TLB.Column);
with var_Column1 do
begin
Visible := False;
Visible := False;
AllowDragging := False;
end;
end;
with Columns.Item['Freight'] do
begin
FormatColumn := 'currency(value)';
Def[EXG2ANTTLib_TLB.exCellBackColor] := OleVariant(12895487);
Def[EXG2ANTTLib_TLB.exHeaderBackColor] := Def[EXG2ANTTLib_TLB.exCellBackColor];
HeaderBold := True;
AllowGroupBy := False;
Alignment := EXG2ANTTLib_TLB.RightAlignment;
end;
ScrollBySingleLine := False;
with Items do
begin
LockedItemCount[EXG2ANTTLib_TLB.exBottom] := 2;
hL := LockedItem[EXG2ANTTLib_TLB.exBottom,0];
ItemDivider[hL] := 0;
ItemHeight[hL] := 3;
ItemDividerLineAlignment[hL] := EXG2ANTTLib_TLB.DividerTop;
ItemDividerLine[hL] := EXG2ANTTLib_TLB.DoubleLine;
hL := LockedItem[EXG2ANTTLib_TLB.exBottom,1];
CellValue[OleVariant(hL),OleVariant(6)] := 'sum(all,rec,dbl(%6))';
CellValueFormat[OleVariant(hL),OleVariant(6)] := EXG2ANTTLib_TLB.exTotalField;
ItemHeight[hL] := 24;
ItemBold[hL] := True;
end;
Columns.Item['EmployeeID'].SortOrder := True;
EndUpdate();
end
|
2190
|
How can I add a total field, when I use grouping
![](images/exg2anttq2190.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemDividerLine[Item] := EXG2ANTTLib_TLB.EmptyLine;
FormatCell[OleVariant(Item),OleVariant(GroupItem[Item])] := 'value + ` Min: <b>` + %13 + `</b> Max: <b>` + %14 + `</b> Sum: <b>` + %15 + `</b>, of Freight column`';
CellValue[OleVariant(Item),'Min'] := 'min(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Min'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Max'] := 'max(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Max'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Sum'] := 'sum(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Sum'] := EXG2ANTTLib_TLB.exTotalField;
ItemBackColor[Item] := $f0f0f0;
end;
end
end;
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
HasLines := EXG2ANTTLib_TLB.exNoLine;
ColumnAutoResize := False;
BackColorSortBar := RGB(240,240,240);
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
SortBarVisible := True;
AllowGroupBy := True;
Columns.Item[OleVariant(1)].SortOrder := True;
with Columns do
begin
(IUnknown(Add('Min')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Max')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Sum')) as EXG2ANTTLib_TLB.Column).Visible := False;
end;
with Columns.Item['Freight'] do
begin
Def[EXG2ANTTLib_TLB.exCellBackColor] := OleVariant(12895487);
Def[EXG2ANTTLib_TLB.exHeaderBackColor] := Def[EXG2ANTTLib_TLB.exCellBackColor];
HeaderBold := True;
AllowGroupBy := False;
end;
ScrollBySingleLine := False;
with Items do
begin
LockedItemCount[EXG2ANTTLib_TLB.exBottom] := 1;
hL := LockedItem[EXG2ANTTLib_TLB.exBottom,0];
ItemDivider[hL] := 0;
ItemHeight[hL] := 24;
ItemDividerLineAlignment[hL] := EXG2ANTTLib_TLB.DividerTop;
ItemDividerLine[hL] := EXG2ANTTLib_TLB.DoubleLine;
CellValue[OleVariant(hL),OleVariant(0)] := 'sum(all,rec,dbl(%6))';
CellValueFormat[OleVariant(hL),OleVariant(0)] := Integer(EXG2ANTTLib_TLB.exTotalField) Or Integer(EXG2ANTTLib_TLB.exHTML);
CellHAlignment[OleVariant(hL),OleVariant(0)] := EXG2ANTTLib_TLB.RightAlignment;
FormatCell[OleVariant(hL),OleVariant(0)] := '''Freight: <bgcolor=FFC4C4> ''+(value format ``) + ` `';
end;
EndUpdate();
end
|
2189
|
How do I use the ColumnsFloatBarVisible on exColumnsFloatBarVisibleIncludeCheckColumns
![](images/exg2anttq2189.png)
with G2antt1 do
begin
BeginUpdate();
ColumnAutoResize := False;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXG2ANTTLib_TLB.Column).Visible := False;
end;
Description[EXG2ANTTLib_TLB.exColumnsFloatBar] := 'Show/Hide';
ColumnsFloatBarSortOrder := EXG2ANTTLib_TLB.SortAscending;
ColumnsFloatBarVisible := EXG2ANTTLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns;
EndUpdate();
end
|
2188
|
The BackColorAlternate displays each second row with a different background color. The question I have it is possible to apply a different background color for 3rd, 4th, row, and so on
![](images/exg2anttq2188.png)
// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TForm1.G2antt1LayoutChanged(ASender: TObject; );
begin
with G2antt1 do
begin
Refresh();
end
end;
// Sort event - Fired when the control sorts a column.
procedure TForm1.G2antt1Sort(ASender: TObject; );
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
HasLines := EXG2ANTTLib_TLB.exNoLine;
ColumnAutoResize := False;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
with (IUnknown(Columns.Add('Position')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 apos ''''';
Visible := False;
end;
ConditionalFormats.Add('(%C13 mod 4) = 0',Null).BackColor := $f0f0f0;
EndUpdate();
end
|
2187
|
The BackColorAlternate looks fine for flat tables, but how about using it when displaying a hierarchy/tree, like grouping rows. The sample alternate colors for each group found
![](images/exg2anttq2187.png)
// LayoutChanged event - Occurs when column's position or column's size is changed.
procedure TForm1.G2antt1LayoutChanged(ASender: TObject; );
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
HasLines := EXG2ANTTLib_TLB.exNoLine;
ColumnAutoResize := False;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
SortBarVisible := True;
AllowGroupBy := True;
Columns.Item[OleVariant(1)].SortOrder := True;
with (IUnknown(Columns.Add('Position')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '(0:= (1 rpos '''')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))';
Visible := False;
end;
ConditionalFormats.Add('(%C13 mod 2) != 0',Null).BackColor := $f0f0f0;
EndUpdate();
end
|
2186
|
I need to display sub-totals in the grouping items. Is there any solution on this
![](images/exg2anttq2186.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemDivider[Item] := -1;
EnableItem[Item] := False;
CellValueFormat[OleVariant(Item),OleVariant(G2antt1.TreeColumnIndex)] := EXG2ANTTLib_TLB.exHTML;
FormatCell[OleVariant(Item),OleVariant(G2antt1.TreeColumnIndex)] := '%1';
CellValueFormat[OleVariant(Item),'Freight'] := Integer(EXG2ANTTLib_TLB.exTotalField) Or Integer(EXG2ANTTLib_TLB.exHTML);
CellValue[OleVariant(Item),'Freight'] := 'sum(current,dir,%6)';
FormatCell[OleVariant(Item),'Freight'] := '`<b>` + currency(value)';
end;
end
end;
with G2antt1 do
begin
BeginUpdate();
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
BackColorSortBar := RGB(240,240,240);
ColumnAutoResize := False;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SortBarVisible := True;
SortBarCaption := 'Drag a <b>column</b> header here to group by that column.';
AllowGroupBy := True;
Columns.Item[OleVariant(1)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
Columns.Item['ShipVia'].DisplayFilterButton := True;
EndUpdate();
end
|
2185
|
I use a subtotal in exTop-Item, after grouping the item shows 0. What is the solution
![](images/exg2anttq2185.png)
with G2antt1 do
begin
BeginUpdate();
ColumnAutoResize := False;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
AllowGroupBy := True;
SortBarVisible := True;
BackColorSortBar := BackColor;
Columns.Item[OleVariant(5)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
Columns.Item[OleVariant(6)].FormatColumn := 'currency(value)';
with Items do
begin
LockedItemCount[EXG2ANTTLib_TLB.exTop] := 1;
h := LockedItem[EXG2ANTTLib_TLB.exTop,0];
ItemBackColor[h] := $f0f0f0;
CellBackColor[OleVariant(h),OleVariant(6)] := $bebebe;
CellValue[OleVariant(h),OleVariant(6)] := 'sum(all,rec,%6)';
CellValueFormat[OleVariant(h),OleVariant(6)] := EXG2ANTTLib_TLB.exTotalField;
end;
Refresh();
EndUpdate();
end
|
2184
|
How can I add multiple values/columns on the same line/item/row
![](images/exg2anttq2184.png)
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
SortOnClick := EXG2ANTTLib_TLB.exNoSort;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
Indent := 13;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderHidden;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
with Columns do
begin
Add('Items');
(IUnknown(Add('Quantity')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
(IUnknown(Add('Value')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
end;
with Items do
begin
h := AddItem('Items');
CellValue[OleVariant(h),OleVariant(2)] := 'sum(current,dir,dbl(%1)*dbl(%2))';
CellValueFormat[OleVariant(h),OleVariant(2)] := EXG2ANTTLib_TLB.exTotalField;
FormatCell[OleVariant(h),OleVariant(2)] := '`Total: `+ value';
CellHAlignment[OleVariant(h),OleVariant(2)] := EXG2ANTTLib_TLB.RightAlignment;
CellBold[OleVariant(h),OleVariant(2)] := True;
CellEditorVisible[OleVariant(h),OleVariant(2)] := EXG2ANTTLib_TLB.exEditorHidden;
CellEditorVisible[OleVariant(h),OleVariant(1)] := EXG2ANTTLib_TLB.exEditorHidden;
h1 := InsertItem(h,Null,'Item 1');
CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(10);
CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(3);
h1 := InsertItem(h,Null,'Item 2');
CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(20);
CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(4);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2183
|
Is it possible, to add more aggregate functions to grouping header
![](images/exg2anttq2183.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
FormatCell[OleVariant(Item),OleVariant(GroupItem[Item])] := 'value + ` Min: <b>` + %13 + `</b> Max: <b>` + %14 + `</b> Sum: <b>` + %15 + `</b>, of Freight column`';
CellValue[OleVariant(Item),'Min'] := 'min(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Min'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Max'] := 'max(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Max'] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(Item),'Sum'] := 'sum(current,all,dbl(%6))';
CellValueFormat[OleVariant(Item),'Sum'] := EXG2ANTTLib_TLB.exTotalField;
end;
end
end;
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
HasLines := EXG2ANTTLib_TLB.exNoLine;
ColumnAutoResize := False;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2antt\Sample\Access\misc.accdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
SingleSort := False;
SortBarVisible := True;
AllowGroupBy := True;
Columns.Item[OleVariant(1)].SortOrder := True;
with Columns do
begin
(IUnknown(Add('Min')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Max')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Sum')) as EXG2ANTTLib_TLB.Column).Visible := False;
end;
EndUpdate();
end
|
2182
|
Is it possible to display more aggregate functions to a single cell (method 2)
![](images/exg2anttq2182.png)
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
SortOnClick := EXG2ANTTLib_TLB.exNoSort;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
Indent := 13;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderHidden;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
with Columns do
begin
Add('Items');
(IUnknown(Add('Quantity')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
(IUnknown(Add('Sum')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Min')) as EXG2ANTTLib_TLB.Column).Visible := False;
(IUnknown(Add('Max')) as EXG2ANTTLib_TLB.Column).Visible := False;
end;
with Items do
begin
h := AddItem('Items');
CellMerge[OleVariant(h),OleVariant(0)] := OleVariant(1);
FormatCell[OleVariant(h),OleVariant(0)] := '`Items, <b>sum(` + %2 + `), min(` + %3 + `), max(` + %4 + `)</b>`';
CellValueFormat[OleVariant(h),OleVariant(0)] := EXG2ANTTLib_TLB.exHTML;
CellValue[OleVariant(h),OleVariant(2)] := 'sum(current,dir,dbl(%1))';
CellValueFormat[OleVariant(h),OleVariant(2)] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(h),OleVariant(3)] := 'min(current,dir,dbl(%1))';
CellValueFormat[OleVariant(h),OleVariant(3)] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(h),OleVariant(4)] := 'max(current,dir,dbl(%1))';
CellValueFormat[OleVariant(h),OleVariant(4)] := EXG2ANTTLib_TLB.exTotalField;
CellValue[OleVariant(InsertItem(h,Null,'Item 1')),OleVariant(1)] := OleVariant(10);
CellValue[OleVariant(InsertItem(h,Null,'Item 2')),OleVariant(1)] := OleVariant(20);
CellValue[OleVariant(InsertItem(h,Null,'Item 3')),OleVariant(1)] := OleVariant(30);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2181
|
How can I use the current in the aggregate/total field
![](images/exg2anttq2181.png)
// Change event - Occurs when the user changes the cell's content.
procedure TForm1.G2antt1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
SortOnClick := EXG2ANTTLib_TLB.exNoSort;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
Indent := 13;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderHidden;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
with Columns do
begin
Add('Items');
(IUnknown(Add('Quantity')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
end;
with Items do
begin
h := AddItem('Items');
CellValue[OleVariant(h),OleVariant(1)] := 'sum(current,dir,dbl(%1))';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXG2ANTTLib_TLB.exTotalField;
FormatCell[OleVariant(h),OleVariant(1)] := '`Total: `+ value';
CellValue[OleVariant(InsertItem(h,Null,'Item 1')),OleVariant(1)] := OleVariant(10);
CellValue[OleVariant(InsertItem(h,Null,'Item 2')),OleVariant(1)] := OleVariant(20);
CellValue[OleVariant(InsertItem(h,Null,'Item 3')),OleVariant(1)] := OleVariant(30);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2180
|
The CellValue/CellCaption property gets the result of a computed/total field with text formatting. Is it possible to get that value without text formatting
![](images/exg2anttq2180.png)
with G2antt1 do
begin
BeginUpdate();
(IUnknown(Columns.Add('A')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
(IUnknown(Columns.Add('B')) as EXG2ANTTLib_TLB.Column).Editor.EditType := EXG2ANTTLib_TLB.SpinType;
Columns.Add('A+B');
with Items do
begin
h := AddItem(OleVariant(10));
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(20);
CellValueFormat[OleVariant(h),OleVariant(2)] := EXG2ANTTLib_TLB.exComputedField;
CellValue[OleVariant(h),OleVariant(2)] := 'currency(dbl(%0)+dbl(%1))';
OutputDebugString( 'CellCaption returns ' );
OutputDebugString( CellCaption[OleVariant(h),OleVariant(2)] );
OutputDebugString( 'CellValue returns ' );
OutputDebugString( CellValue[OleVariant(h),OleVariant(2)] );
OutputDebugString( 'ComputeValue returns ' );
OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',OleVariant(h),OleVariant(0),OleVariant(CellValueFormat[OleVariant(h),OleVariant(2)])] );
end;
EndUpdate();
end
|
2179
|
Can I get the result of a specified formula as your control does using the ComputedField property
with G2antt1 do
begin
BeginUpdate();
Columns.Add('A');
Columns.Add('B');
with Items do
begin
h := AddItem(OleVariant(10));
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(20);
OutputDebugString( 'A+B is ' );
OutputDebugString( ComputeValue['dbl(%0)+dbl(%1)',OleVariant(h),OleVariant(0),OleVariant(2)] );
end;
EndUpdate();
end
|
2178
|
Is it possible to get the text without HTML formatting
with G2antt1 do
begin
BeginUpdate();
Columns.Add('');
with Items do
begin
h := AddItem('<b>bold</b>');
OutputDebugString( ComputeValue[CellValue[OleVariant(h),OleVariant(0)],OleVariant(h),OleVariant(0),OleVariant(1)] );
end;
EndUpdate();
end
|
2177
|
Transparent/Border SummaryBar
![](images/exg2anttq2177.png)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection.
procedure TForm1.G2antt1AddGroupItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
with Items do
begin
ItemDividerLine[Item] := EXG2ANTTLib_TLB.EmptyLine;
AddBar(Item,'Summary','12/2/2017','12/2/2017',Null,Null);
DefineSummaryBars(Item,'',-3,'');
end;
end
end;
// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TForm1.G2antt1AddItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
Items.AddBar(Item,'Task','12/4/2017','12/10/2017',Null,Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABHEGACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSKUOQTDKMIziaQJiYLBIaRgEUTRXASCQxDBKQBSeKkRRtDaOYDnGQYDi' +
'CIouQLEIxDKItBSJCKURJkAZZHjeToSR5PMb0dKdAw5I6raShEaaIiqJIXP7Fc7QSA0EgTBIFajgOpQAb+bptW7FVDULTMQS5FCZKasOA7FgOZ4DWjUVpwTZ1Q4LC65b' +
'juaraawKbYbXrFYJQSA8EwjNjDcLuKqcKpvDJsSJIFKxOB2KYtBLMLbzLR5apjLZ0QLSOKRDoMEgRDYGdKjLScGrGao8ABtcBlAZJRjoOo5DJgeCQapUQhNczGQzQSIi' +
'BOJZAFSQwRHcJhGh2BZvngMIeA8H4TksA5ylgZBeg8X4GmGX4nniPazneQ5VnKdp9H8P4vD+X57nMRofmgBZ4FgIAoBWdoBGAGAeAgfxfjgNZ1DqWxEA0ASAgA==');
with Chart do
begin
LevelCount := 2;
FirstVisibleDate := '12/2/2017';
PaneWidth[False] := 256;
with Bars.Item['Summary'] do
begin
Color := $1000000;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%513%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
Def[EXG2ANTTLib_TLB.exBarCaptionHOffset] := OleVariant(8);
end;
with Bars.Item['Task'] do
begin
Pattern := EXG2ANTTLib_TLB.exPatternBox;
Color := $0;
end;
end;
with Columns do
begin
Add('C1');
Add('C2');
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 pos ``';
AllowGroupBy := False;
Position := 0;
Width := 48;
AllowSizing := False;
end;
end;
SortBarVisible := True;
AllowGroupBy := True;
BackColorSortBar := BackColor;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Items do
begin
CellValue[OleVariant(AddItem('Item A')),OleVariant(1)] := 'SubItem A.1';
CellValue[OleVariant(AddItem('Item A')),OleVariant(1)] := 'SubItem A.2';
CellValue[OleVariant(AddItem('Item A')),OleVariant(1)] := 'SubItem A.3';
CellValue[OleVariant(AddItem('Item A')),OleVariant(1)] := 'SubItem A.4';
CellValue[OleVariant(AddItem('Item B')),OleVariant(1)] := 'SubItem B.1';
CellValue[OleVariant(AddItem('Item B')),OleVariant(1)] := 'SubItem B.2';
end;
Columns.Item[OleVariant(0)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
EndUpdate();
end
|
2176
|
The bar's caption is very difficult to read if any pattern than exPatternSolid is used. Is there any way of displaying the bar's caption (except for displaying the caption outside the bar)
![](images/exg2anttq2176.png)
with G2antt1 do
begin
BeginUpdate();
Font.Size := 12;
DefaultItemHeight := 24;
Columns.Add('Task');
with Chart do
begin
LevelCount := 2;
FirstVisibleDate := '1/1/2001';
with Bars.Item['Task'] do
begin
Height := 21;
Pattern := EXG2ANTTLib_TLB.exPatternDiagCross;
end;
PaneWidth[False] := 128;
UnitWidth := 24;
end;
with Items do
begin
h := AddItem('');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := 'to do';
h := AddItem('bgcolor');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := '<bgcolor=FFFFFF> to do </bgcolor>';
h := AddItem('fgcolor');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := '<fgcolor=FFFFFF> to do </fgcolor>';
h := AddItem('sha');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := '<sha FFFFFF;2;2> to do </sha>';
h := AddItem('out');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := '<out 000000><fgcolor=FFFFFF>to do</fgcolor></out></font>';
h := AddItem('gra');
AddBar(h,'Task','1/2/2001','1/6/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaption] := '<fgcolor FFFFFF><gra 000000;1;1>to do</fgcolor>';
end;
EndUpdate();
end
|
2175
|
How can I change the position of the bar's tooltip
![](images/exg2anttq2175.png)
// ToolTip event - Fired when the control prepares the object's tooltip.
procedure TForm1.G2antt1ToolTip(ASender: TObject; Item : HITEM;ColIndex : Integer;var Visible : WordBool;var X : Integer;var Y : Integer;CX : Integer;CY : Integer);
begin
with G2antt1 do
begin
OutputDebugString( 'ToolTip' );
OutputDebugString( Item );
OutputDebugString( ColIndex );
OutputDebugString( Visible );
OutputDebugString( X );
OutputDebugString( Y );
OutputDebugString( CX );
OutputDebugString( CY );
X := FormatABC('value + 8',OleVariant(X),Null,Null);
Y := FormatABC('value - 8',OleVariant(Y),Null,Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
with Chart do
begin
PaneWidth[False] := 64;
FirstVisibleDate := '1/1/2001';
Bars.Item['Task'].Def[EXG2ANTTLib_TLB.exBarToolTip] := '<b><%=%9 + ''/'' + %C0%></b><br><upline><dotline>Start: <%=%1%><br>End: <%=%2%><br>Duration: <%=(%2-%1)%><br>Working: <%=%258%>';
LevelCount := 2;
end;
with Items do
begin
AddBar(AddItem('Tasks A'),'Task','1/2/2001','1/4/2001',Null,Null);
AddBar(AddItem('Tasks B'),'Task','1/3/2001','1/8/2001',Null,Null);
end;
EndUpdate();
end
|
2174
|
How can I replace the cell's context menu ( while edit mode is running )
![](images/exg2anttq2174.png)
// RClick event - Fired when right mouse button is clicked
procedure TForm1.G2antt1RClick(ASender: TObject; );
begin
with G2antt1 do
begin
OutputDebugString( 'Edit Mode: ' );
OutputDebugString( Editing );
with (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ContextMenu'))) as EXCONTEXTMENULib_TLB.ExContextMenu) do
begin
Items.ToString := 'Check[chk],[sep],Item 1,Item 2,Item 3,Popup(A,B,C)';
OutputDebugString( Select(Null,Null,Null) );
end;
end
end;
with G2antt1 do
begin
BeginUpdate();
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
with (IUnknown(Columns.Add('Column')) as EXG2ANTTLib_TLB.Column).Editor do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Option[EXG2ANTTLib_TLB.exEditAllowContextMenu] := OleVariant(False);
end;
with Items do
begin
AddItem('Item 1');
AddItem('Item 2');
end;
EndUpdate();
end
|
2173
|
Is it possible to highlight the column's header once a filter is applied (sample 2)
![](images/exg2anttq2173.png)
with G2antt1 do
begin
BeginUpdate();
with VisualAppearance do
begin
Add(1,'gBFLBCJwBAEHhEJAAEhABO8GACAADACAxRDgMQBQKAAzQFAYbBuGCGAAGIYBTgmFgAQhFcZQSKUOQTDKNYykCIRSDUJYkSZEIyjBI8ExXFqNACkGKwQgmNYDSBMcbwSA' +
'sXRYFocJ5gOT6AjKBA2UclEZpajiTY3ABUEgUS5oOBIACqariaQJAAiCRQGiYZyHKaRSwPBKFYDIIjbJheTIDChNVxUcDENQjJqLBIDRzbarye59YBfeBXdgmA4LQbDM' +
'RwNgMMQTDqKYbkOQZHbeGKAWTMEZzJj8cxTEqIaBhGTLfojSZMS7UGK1LLtMyHI6kP7sOiLfi2W4/W7XV72F79TzXIa2ZBuO57bhnAZ/VzGNj4PRNezfRqicjsGxcZwX' +
'g+TpQj0ew6gSOw7wSbozjsfYXi8PwMnSc52leHotl+MxjmoXh2nybxOH+SQtnYXx+D2P4vGMB56hQf5PCgBYeDwYBCEo1xggebgKH6IIDBYBgkiAQ5FgYPAhEIRgWGqD' +
'BoC4GoCiGCBYhGBQPAWdIQp0eIUiWCZigiJgqgqYpIioJQhmIMhBH0NxjEMag2g2Y4ImYOoOmOSJeDQNxXlOLR3ECUAQICA=');
Add(2,'gBFLBCJwBAEHhEJAAEhABgsHQAAYAQGKIcBiAKBQAGaAoDDYNwwQwAAxDAKcEwsACEIrjKCRShyCYZRrGUgRCKQahLEiTIhGUYJHgmK4tRoAUgxWCEExrAaQJjjeCQFi' +
'6LAtDhPMByfQEZQIGyjkgjNLUcSbG4AKgkCiXfpUAJVP7FcgSABEEigNIxToOU4jFgeCYLQKQRK2RC9GQGFCbLhpYKIahGTYWVheN5XXblez9P7ABQwKCcAwXBp7YIKA' +
'T4XBIdYdQ7IL4xGA0AJPFoJC7mOQ5XiYAIBAZ/RL0LCcbxHHafVboQj6JouD5PUDVNY1XBdPynI6CbLhWy6Dq4UZzPwzeBifSHfDjRoJcCZe71KY3GwSEboNA6Kp+QBH' +
'AmZoZjSPYIEiF47lOLJVnuYofBwJJHmaQoYj0MIRHeM4/m6cJ8B+fpBHQJ5SGKPYYH8OYMk+P5Bn4fxaAYZAvEIX4RgUWBGgCCAmAqApgkgNgOgMEYlGASoEkQeBWBaB' +
'ZhggZgagaYRoEwShWA6NZZAMQBAICA==');
end;
Background[EXG2ANTTLib_TLB.exHeaderFilterBarButton] := $1000000;
Background[EXG2ANTTLib_TLB.exHeaderFilterBarActive] := $2000000;
Background[EXG2ANTTLib_TLB.exCursorHoverColumn] := $ffffffff;
HeaderHeight := 28;
BackColorHeader := RGB(255,255,255);
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
with Columns do
begin
(IUnknown(Add('C1')) as EXG2ANTTLib_TLB.Column).DisplayFilterButton := True;
with (IUnknown(Add('C2')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
Filter := 'Item 2';
FilterType := EXG2ANTTLib_TLB.exFilter;
end;
(IUnknown(Add('C3')) as EXG2ANTTLib_TLB.Column).DisplayFilterButton := True;
end;
with Items do
begin
h := AddItem('Item 1');
CellValue[OleVariant(h),OleVariant(1)] := 'Item 2';
CellValue[OleVariant(h),OleVariant(2)] := 'Item 3';
h := AddItem('Item 4');
CellValue[OleVariant(h),OleVariant(1)] := 'Item 5';
CellValue[OleVariant(h),OleVariant(2)] := 'Item 6';
end;
ApplyFilter();
EndUpdate();
end
|
2172
|
How can I make the expand/collapse glyphs DPI aware
![](images/exg2anttq2172.png)
with G2antt1 do
begin
size := 2;
BeginUpdate();
with VisualAppearance do
begin
Add(3,'gBFLBCJwBAEHhEJAAEhEGAUHQAAYAQGKIcBiAKBQAGaAoDDYOA4QwAAxDAKcEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQiiCYsS5GQBRfIUEghGyNZjgNzQcC' +
'QAI8T5IUgARBJIDSMY6DpOIxYHgmC4DEITNLxOK0EhRHCBZrgOCAYhqEY1Ro+dhPFYjVTMdK0LRtKy7Mq2aJmOpZDxWE7dZKpO5fbxXS67cr2fp/YBed4rfa7KTlOBKc' +
'RQRBEFQPDqPZBkORZHh2FoLRJKbgtHJmHYNQWhVyYBbNCyTI6lahpeuHBx1QaWWxjbCMEr6bpoWLbFi3Ha1UzrPa8b5vSw7Gr+HzYQTHGPXGqaYJdZrnea6B7+U5XUJr' +
'nSOZciYHwhAeR5HDK+JVGqKRRmScx5HyfRei+H5bmmcp4Fi8o/CGGJKGQKZUGoFQigUPIiCeSZXnyHB6l0SAJn8JxfkIeZ5CgXxjCCAhyB8QgIlAM4MlKAIcCaIBIGYG' +
'oGGEYhqBMMxgnICgRDUDQjESGwmAkWBuCqBoiHIVgkDQYgYESWg2E0YhohcJQigITg3CQSRyEyEYGGOWJwhQJD4FiFIMk0aJFGsIBkkOBJeDc+AchYJwJgIWhSgYZQpF' +
'IVoVGOGQ4l2EwIBWMhgDmDhThCEwkAiaJchKDhjhgZhsCUY4iFCEoZkiaYQmSGAWhWQhgDuDpTjCDQiEgchAg0IpJBoDoFiEKBqCaCAimgIguH8IZnkPUhcBcJg+hGJZ' +
'nloYJsiaKZKGa24YnWSR0CkKhCA2CxlCqColhAYpqEKER0DqVZ0A0ASAgA==');
Add(4,'gBFLBCJwBAEHhEJAAEhABAQCg6AADACAxRDgMQBQKAAzQFAYbBwHCGAAGIYBTgmFgAQhFcZQSKUOQTDKNYykCIRSDUJYkSZEIyjBI8ExXFqNACjeQYJBCNYbTJAbqhYI' +
'gAR3HqQZABCCSQKkYx0HScRiwPBMFwGIQmaaicZoJCiN4DTZAcIBRDUIxpDR9bBeKw3KqVaZnWhaNpWXZlTzKdSxXisF67RZSdi/XgvF5XXblez9P69LwXe5mUrGbyVY' +
'ghCCIKgeG4dR7IMhyLDcKQXCCVW7aGSsOwbAqAXpdGAXTQdDyLJKnaZqOi6BjjA4rNbHGIYJb1XTRMa1LJuG5LJrOeZ3Xre4BLfh1VoFRpjWIYNY1QS7TLOczzfRdDxT' +
'iGVpkjCeJoD4Ng1hSRxiisVRKg8D4PkWZJznmPQ+F8Xx5guWpjHGWYMiYQodEaIRSCgU5KCSeh3naHB/iAAh9n8fwfgIeZ1CgXwjCCAhxl8AgIlAM4MlKAIcCaD54FYF' +
'oFmGCBmBaBIJigPJNgKSAoDSVC+BIbIYCUYYoiYKoJgkWIMlGCAglMaJZDWCYiFyFIJkkOJYhEJc7G4PYPCOaJshQJBjgiVIUgyDRokEaggGSQ4El4N1CBiFgnAmAhaF' +
'KFZlFkShUhWJRYmITg3GSQgFGuGBOGOFJkCSSQCDoNgkiOCY0hUJJmmmQhvhqZtYmUOQmBWIRvhgTpjjSbAjEiEgchBZgyEaBIhigWgegqIhIjoDILiACB5nTL5WnWRY' +
'OiSKYJnqGQ7CmOh2hqJ5OkYORxFyShKhSAxihkOomioY5YiqFIkFyTo1HkAxAEAgIA==');
Add(1,G2antt1.FormatABC('`CP:3 -` + int(value*dpi) + ` -` + int(value*dpi) + ` ` + int(value*dpi) + ` ` + int(value*dpi)',OleVariant(size),Null,Null));
Add(2,G2antt1.FormatABC('`CP:4 -` + int(value*dpi) + ` -` + int(value*dpi) + ` ` + int(value*dpi) + ` ` + int(value*dpi)',OleVariant(size),Null,Null));
end;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesAtRoot;
HasButtons := EXG2ANTTLib_TLB.exCustom;
HasButtonsCustom[False] := 16777216;
HasButtonsCustom[True] := 33554432;
Columns.Add('Column');
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child');
end;
EndUpdate();
end
|
2171
|
Is it possible to highlight the column's header once a filter is applied (sample 1)
![](images/exg2anttq2171.png)
with G2antt1 do
begin
BeginUpdate();
with VisualAppearance do
begin
Add(2,'gBFLBCJwBAEHhEJAAEhABX8GACAADACAxSDEMQBQKAAzQFAYbhgHCGAAGQaBUgmFgAQhFcZQSKUOQTDKNYykCIRSDUJYkSZEIyjBI8ExXFqNACkGKwYgmNYiTLAcgANJ' +
'0WBaGIZJ4gOT5fDKMoEDRRYADFCscwxJybQAqGQKKb+VgAVY/cTyBIAEQSKA0TDOQ5TSKWB4JPZQRBEbZMNBtBIUJquKaqShdQJCU5FdY3Xblez9P7AMBwLFEC4NQ8YN' +
'YuPhjR4dRTIMhvVAsUArFh8Zg9GZZFjmDIDT4ydBLTQwcyVIKnP5qOa6XbmPoCQDYKxZHYxPzVDa3axuL76dqCAT7XrXNy1TbNRrzQKfcJqfCbdw2YaDZLOOT3fjuI4h' +
'hKaRzFAHJ+jYQ4xHuY4gHuGIXGeExqC8Tp6C+PoEm+G5ImycRgh0XwvDGa5rgOeoejyXwnFeQp2mkf5ClgBB9gCWIYAwfYAEKV58mkdwOggNArgOXY2EWLoDkKOA0mgb' +
'hOGgZApgaSBIHWSYHSmbApgYThmESZYJkIeIkgeCpfliLIHgpMIcmUYYYmODAlg2SI4mWfRfGOEguDcCRjFYAJihCQhJBSDoRmONgKEcI4kFCEJhhOVYTmYnAlEAQhWB' +
'MJYJGYWoWmWSR2F6F5lnkWAQhUAgpEieRWEuSYkjWGpmkmNhuhuZwJkYcocmaaYkjyEhngnUA6lEFAlAEgI=');
Add(1,'CP:2 -8 -4 2 4');
end;
Background[EXG2ANTTLib_TLB.exHeaderFilterBarButton] := $1fefefe;
Background[EXG2ANTTLib_TLB.exHeaderFilterBarActive] := $1010101;
Background[EXG2ANTTLib_TLB.exCursorHoverColumn] := $ffffffff;
HeaderHeight := 28;
BackColorHeader := RGB(255,255,255);
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
with Columns do
begin
(IUnknown(Add('C1')) as EXG2ANTTLib_TLB.Column).DisplayFilterButton := True;
with (IUnknown(Add('C2')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
Filter := 'Item 2';
FilterType := EXG2ANTTLib_TLB.exFilter;
end;
(IUnknown(Add('C3')) as EXG2ANTTLib_TLB.Column).DisplayFilterButton := True;
end;
with Items do
begin
h := AddItem('Item 1');
CellValue[OleVariant(h),OleVariant(1)] := 'Item 2';
CellValue[OleVariant(h),OleVariant(2)] := 'Item 3';
h := AddItem('Item 4');
CellValue[OleVariant(h),OleVariant(1)] := 'Item 5';
CellValue[OleVariant(h),OleVariant(2)] := 'Item 6';
end;
ApplyFilter();
EndUpdate();
end
|
2170
|
How do I update itemcount and matchitemcount of the FilterBarCaption after I added the item using the AddItem method
// Click event - Occurs when the user presses and then releases the left mouse button over the tree control.
procedure TForm1.G2antt1Click(ASender: TObject; );
begin
with G2antt1 do
begin
Items.AddItem('new');
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
with (IUnknown(Columns.Add('Item')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
FilterList := Integer(EXG2ANTTLib_TLB.exShowExclude) Or Integer(EXG2ANTTLib_TLB.exShowFocusItem) Or Integer(EXG2ANTTLib_TLB.exShowCheckBox) Or Integer(EXG2ANTTLib_TLB.exSortItemsAsc);
end;
with (IUnknown(Columns.Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
AllowSizing := False;
AllowSort := False;
Width := 32;
FormatColumn := '1 apos ``';
Position := 0;
end;
with Items do
begin
AddItem('Item A');
AddItem('Item B');
AddItem('Item C');
end;
FilterBarCaption := '`<r>` + value + `</b><fgcolor=808080>` + ( matchitemcount < 0 ? ( ( len(value) ? `<br>` : `` ) + `<r>` + abs(matchitemcount + 1)' +
' + ` result(s)` ) : (`<fgcolor=808080>`+ itemcount + ` item(s)`) )';
FilterBarPromptVisible := Integer(EXG2ANTTLib_TLB.exFilterBarCompact) Or Integer(EXG2ANTTLib_TLB.exFilterBarShowCloseOnRight) Or Integer(EXG2ANTTLib_TLB.exFilterBarShowCloseIfRequired) Or Integer(EXG2ANTTLib_TLB.exFilterBarCaptionVisible) Or Integer(EXG2ANTTLib_TLB.exFilterBarVisible) Or Integer(EXG2ANTTLib_TLB.exFilterBarPromptVisible);
EndUpdate();
end
|
2169
|
The Edit method does not work while ReadOnly property is exLocked and the first column is hidden. Is there any fix
![](images/exg2anttq2169.png)
// DblClick event - Occurs when the user dblclk the left mouse button over an object.
procedure TForm1.G2antt1DblClick(ASender: TObject; Shift : Smallint;X : Integer;Y : Integer);
begin
with G2antt1 do
begin
var_ItemFromPoint := ItemFromPoint[-1,-1,c,hit];
FocusColumnIndex := c;
Edit(Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
AutoEdit := False;
ReadOnly := EXG2ANTTLib_TLB.exLocked;
AutoSearch := True;
(IUnknown(Columns.Add('')) as EXG2ANTTLib_TLB.Column).Visible := False;
with (IUnknown(Columns.Add('Contains')) as EXG2ANTTLib_TLB.Column) do
begin
AutoSearch := EXG2ANTTLib_TLB.exContains;
Editor.EditType := EXG2ANTTLib_TLB.EditType;
end;
with Items do
begin
CellValue[OleVariant(AddItem(Null)),OleVariant(1)] := 'Tom Hanks';
CellValue[OleVariant(AddItem(Null)),OleVariant(1)] := 'Leonardo DiCaprio';
CellValue[OleVariant(AddItem(Null)),OleVariant(1)] := 'Will Smith';
CellValue[OleVariant(AddItem(Null)),OleVariant(1)] := 'Tom Cruise';
end;
EndUpdate();
end
|
2168
|
How can I highlight the cell's button with a different appearance, when cursor hovers it
![](images/exg2anttq2168.png)
with G2antt1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'c:\exontrol\images\normal.ebn');
DefaultItemHeight := 22;
TreeColumnIndex := -1;
SelForeColor := RGB(0,0,0);
SelBackColor := BackColor;
Background[EXG2ANTTLib_TLB.exCursorHoverCellButton] := $1000000;
with (IUnknown(Columns.Add('Buttons')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasButton] := OleVariant(True);
Def[EXG2ANTTLib_TLB.exCellValueFormat] := OleVariant(1);
Alignment := EXG2ANTTLib_TLB.CenterAlignment;
HeaderAlignment := EXG2ANTTLib_TLB.CenterAlignment;
end;
with Items do
begin
AddItem('Button <b>1</b>');
AddItem('Button <b>2</b>');
AddItem('Button <b>3</b>');
end;
EndUpdate();
end
|
2167
|
How to group one or more operations into a block when the user do undo or redo
![](images/exg2anttq2167.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
AllowUndoRedo := True;
FirstVisibleDate := '6/20/2005';
AllowLinkBars := True;
LevelCount := 2;
PaneWidth[False] := 64;
Bars.Item['Task'].Height := 16;
end;
with Items do
begin
StartBlockUndoRedo();
AddBar(AddItem('Task 1'),'Task','6/23/2005','6/27/2005','',Null);
AddBar(AddItem('Task 2'),'Task','6/28/2005','7/2/2005','',Null);
AddLink('L1',ItemByIndex[0],'',ItemByIndex[1],'');
EndBlockUndoRedo();
h := ItemByIndex[1];
end;
with Chart.Notes.Add('NoteD',OleVariant(h),'6/26/2005','CTRL+Z (undo), CTRL+Y (redo)') do
begin
PartShadow[EXG2ANTTLib_TLB.exNoteEnd] := False;
PartToolTip[EXG2ANTTLib_TLB.exNoteEnd] := 'Press CTRL+Z to undo <br> and then press CTRL+Y to redo';
PartTransparency[EXG2ANTTLib_TLB.exNoteEnd] := 25;
PartVOffset[EXG2ANTTLib_TLB.exNoteEnd] := -2;
PartBackColor[EXG2ANTTLib_TLB.exNoteEnd] := $ffff;
end;
EndUpdate();
end
|
2166
|
I am using the Link property to customize the link, but when I press redo it (CTRL+Y) to redo it, not all properties are restored. What can be done
![](images/exg2anttq2166.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
AllowUndoRedo := True;
FirstVisibleDate := '6/20/2005';
AllowLinkBars := True;
LevelCount := 2;
PaneWidth[False] := 64;
Bars.Item['Task'].Height := 16;
end;
with Items do
begin
AddBar(AddItem('Task 1'),'Task','6/23/2005','7/1/2005','',Null);
AddBar(AddItem('Task 2'),'Task','6/27/2005','7/4/2005','',Null);
StartBlockUndoRedo();
AddLink('L1',ItemByIndex[0],'',ItemByIndex[1],'');
u := StartUpdateLink['L1'];
Link['L1',EXG2ANTTLib_TLB.exLinkWidth] := OleVariant(2);
Link['L1',EXG2ANTTLib_TLB.exLinkText] := '<fgcolor FF0000>CTRL+Z (undo), CTRL+Y (redo)';
Link['L1',EXG2ANTTLib_TLB.exLinkToolTip] := 'Press CTRL+Z to undo <br> and then press CTRL+Y to redo';
Link['L1',EXG2ANTTLib_TLB.exLinkStartPos] := OleVariant(0);
Link['L1',EXG2ANTTLib_TLB.exLinkColor] := OleVariant(255);
EndUpdateLink(u);
EndBlockUndoRedo();
end;
EndUpdate();
end
|
2165
|
I am using the ItemBar property to customize the task, but when I press redo it (CTRL+Y) to redo it, not all properties are restored. What can be done
![](images/exg2anttq2165.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
AllowUndoRedo := True;
FirstVisibleDate := '6/20/2005';
AllowLinkBars := True;
LevelCount := 2;
PaneWidth[False] := 64;
Bars.Item['Task'].Height := 16;
end;
with Items do
begin
AddBar(AddItem('Task 1'),'Task','6/21/2005','6/30/2005','',Null);
h := AddItem('Task 2');
StartBlockUndoRedo();
AddBar(h,'Task','6/27/2005','7/4/2005','','CTRL+Z (undo), CTRL+Y (redo)');
u := StartUpdateBar[h,''];
ItemBar[h,'',EXG2ANTTLib_TLB.exBarColor] := OleVariant(255);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarToolTip] := 'Press CTRL+Z to undo <br> and then press CTRL+Y to redo';
EndUpdateBar(u);
EndBlockUndoRedo();
end;
EndUpdate();
end
|
2164
|
The incremental search feature is no working for columns with editor assigned. What can be done
![](images/exg2anttq2164.png)
// DblClick event - Occurs when the user dblclk the left mouse button over an object.
procedure TForm1.G2antt1DblClick(ASender: TObject; Shift : Smallint;X : Integer;Y : Integer);
begin
with G2antt1 do
begin
Edit(Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
AutoEdit := False;
AutoSearch := True;
with (IUnknown(Columns.Add('Contains')) as EXG2ANTTLib_TLB.Column) do
begin
AutoSearch := EXG2ANTTLib_TLB.exContains;
Editor.EditType := EXG2ANTTLib_TLB.EditType;
end;
with Items do
begin
AddItem('Tom Hanks');
AddItem('Leonardo DiCaprio');
AddItem('Will Smith');
AddItem('Tom Cruise');
end;
EndUpdate();
end
|
2163
|
Each item is representated by a key as string. Is it possible to have a drop down editor to display more information when using the item's key
![](images/exg2anttq2163.png)
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with (IUnknown(Columns.Add('Multiple-Columns Tree DropDownListType')) as EXG2ANTTLib_TLB.Column).Editor do
begin
EditType := EXG2ANTTLib_TLB.DropDownListType;
AddItem(0,'KR|Korea, Republic of',Null);
AddItem(1,'MO|Macao',Null);
AddItem(2,'SA|Saudi Arabia',Null);
AddItem(3,'EG|Egypt',Null);
AddItem(4,'GB|United Kingdom',Null);
AddItem(5,'GT|Guatemala',Null);
AddItem(6,'SR|Suriname',Null);
AddItem(7,'BM|Bermuda',Null);
end;
with Items do
begin
AddItem('EG');
AddItem('GB');
AddItem('BM');
end;
EndUpdate();
end
|
2162
|
My table includes codes/keys for items, can I display a drop down editor to include more information
![](images/exg2anttq2162.png)
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with (IUnknown(Columns.Add('Multiple-Columns DropDownListType')) as EXG2ANTTLib_TLB.Column).Editor do
begin
EditType := EXG2ANTTLib_TLB.DropDownListType;
DropDownAutoWidth := EXG2ANTTLib_TLB.exDropDownEditorWidth;
Option[EXG2ANTTLib_TLB.exDropDownColumnCaption] := 'City¦Coordinates¦State';
AddItem(0,'JV3|Jollyville¦3026N 09746W¦Texas',Null);
AddItem(1,'TMO|Altamont¦4021N 11017W¦Utah',Null);
AddItem(2,'IIM|Williamston¦4241N 08417W¦Michigan',Null);
AddItem(3,'IWN|Merrittstown¦3958N 07952W¦Pennsylvania',Null);
AddItem(4,'HOU|Houston¦2945N 09521W¦Texas',Null);
AddItem(5,'GSF|Gales Ferry¦4125N 07205W¦Connecticut',Null);
end;
with Items do
begin
AddItem('HOU');
AddItem('IIM');
AddItem('TMO');
end;
EndUpdate();
end
|
2161
|
How can I display and select from a multiple-columns tree editor
![](images/exg2anttq2161.png)
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' +
'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' +
'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' +
'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=');
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with (IUnknown(Columns.Add('Multiple-Columns Tree DropDownListType')) as EXG2ANTTLib_TLB.Column).Editor do
begin
EditType := EXG2ANTTLib_TLB.DropDownListType;
DropDownAutoWidth := EXG2ANTTLib_TLB.exDropDownEditorWidth;
Option[EXG2ANTTLib_TLB.exDropDownColumnCaption] := 'Name¦Title¦City¦Phone';
Option[EXG2ANTTLib_TLB.exDropDownColumnWidth] := '224¦¦¦96';
AddItem(1,'Nancy Davolio¦Sales Representative¦Seattle¦(206) 555-9857',OleVariant(1));
AddItem(2,'Andrew Fuller¦<b>Vice President</b>, Sales¦Tacoma¦(206) 555-9482',OleVariant(2));
InsertItem(3,'Janet Leverling¦Sales Representative¦Kirkland¦(206) 555-3412',OleVariant(3),OleVariant(2));
InsertItem(4,'Peacock Margaret¦Sales Representative¦Redmond¦(206) 555-8122',OleVariant(3),OleVariant(2));
InsertItem(5,'Steven Buchanan¦Sales Manager¦London¦(71) 555-4848',OleVariant(2),OleVariant(2));
InsertItem(6,'Michael Suyama¦Sales Representative¦London¦(71) 555-7773',OleVariant(1),OleVariant(5));
InsertItem(7,'Robert King¦Sales Representative¦Kirkland¦(71) 555-5598',OleVariant(2),OleVariant(2));
InsertItem(8,'Laura Callahan¦Inside Sales Coordinator¦Seattle¦(206) 555-1189',OleVariant(3),OleVariant(2));
InsertItem(9,'Anne Dodsworth¦Sales Representative¦London¦(71) 555-4444',OleVariant(2),OleVariant(5));
ExpandAll();
end;
with Items do
begin
AddItem(OleVariant(1));
AddItem(OleVariant(2));
AddItem(OleVariant(4));
end;
EndUpdate();
end
|
2160
|
Does you control support multiple-columns for a drop down editor
![](images/exg2anttq2160.png)
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[True] := 0;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with (IUnknown(Columns.Add('Multiple-Columns DropDownListType')) as EXG2ANTTLib_TLB.Column).Editor do
begin
EditType := EXG2ANTTLib_TLB.DropDownListType;
DropDownAutoWidth := EXG2ANTTLib_TLB.exDropDownEditorWidth;
AddItem(0,'Jollyville¦JV3¦3026N 09746W¦TX',Null);
AddItem(1,'Altamont¦TMO¦4021N 11017W¦UT',Null);
AddItem(2,'Williamston¦IIM¦4241N 08417W¦MI',Null);
AddItem(3,'Merrittstown¦IWN¦3958N 07952W¦PA',Null);
AddItem(4,'Houston¦HOU¦2945N 09521W¦TX',Null);
AddItem(5,'Gales Ferry¦GSF¦4125N 07205W¦CT',Null);
end;
with Items do
begin
InsertItem(0,'',OleVariant(1));
InsertItem(0,'',OleVariant(2));
InsertItem(0,'',OleVariant(4));
end;
EndUpdate();
end
|
2159
|
Is it possible to change the summary-bar's start or/and end margins
![](images/exg2anttq2159.png)
with G2antt1 do
begin
BeginUpdate();
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
ColumnAutoResize := False;
with Chart do
begin
AllowCreateBar := EXG2ANTTLib_TLB.exNoCreateBar;
AllowLinkBars := False;
FirstVisibleDate := '1/1/2008';
LevelCount := 2;
PaneWidth[False] := 256;
end;
(IUnknown(Columns.Add('Members')) as EXG2ANTTLib_TLB.Column).Width := 96;
with (IUnknown(Columns.Add('Start')) as EXG2ANTTLib_TLB.Column) do
begin
Width := 112;
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(1);
LevelKey := OleVariant(1);
end;
with (IUnknown(Columns.Add('End')) as EXG2ANTTLib_TLB.Column) do
begin
Width := 112;
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(2);
LevelKey := OleVariant(1);
end;
with Items do
begin
AllowCellValueToItemBar := True;
hR1 := AddItem('Team');
AddBar(hR1,'Summary','1/2/2008','1/8/2008','',Null);
AddBar(hR1,'','1/13/2008','1/13/2008','R',Null);
ItemBar[hR1,'R',EXG2ANTTLib_TLB.exBarTransparent] := OleVariant(100);
DefineSummaryBars(hR1,'',h1,'R');
h1 := InsertItem(hR1,Null,'Member 1');
AddBar(h1,'Task','1/2/2008','1/7/2008',Null,Null);
DefineSummaryBars(hR1,'',h1,'');
h1 := InsertItem(hR1,Null,'Member 2');
AddBar(h1,'Task','1/4/2008','1/9/2008',Null,Null);
DefineSummaryBars(hR1,'',h1,'');
h1 := InsertItem(hR1,Null,'Member 3');
AddBar(h1,'Task','1/5/2008','1/10/2008',Null,Null);
DefineSummaryBars(hR1,'',h1,'');
ExpandItem[hR1] := True;
end;
EndUpdate();
end
|
2158
|
I want to display two lines/curves in the histogram-area such as expected and actual work effor per month. How can I do that (leaf)
![](images/exg2anttq2158.png)
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
PaneWidth[False] := 128;
FirstVisibleDate := '10/5/2020';
HistogramVisible := True;
HistogramHeight := 96;
HistogramView := Integer(EXG2ANTTLib_TLB.exHistogramNoGrouping) Or Integer(EXG2ANTTLib_TLB.exHistogramRecLeafItems) Or Integer(EXG2ANTTLib_TLB.exHistogramLeafItems) Or Integer(EXG2ANTTLib_TLB.exHistogramUnlockedItems);
with Bars.Item['Task'] do
begin
HistogramPattern := EXG2ANTTLib_TLB.exRectangularCurve;
HistogramItems := -4;
HistogramBorderSize := 1;
end;
with Bars.Copy('Task','C') do
begin
HistogramPattern := EXG2ANTTLib_TLB.exRectangularCurve;
HistogramItems := -4;
HistogramColor := $ff;
HistogramBorderSize := 2;
end;
end;
Columns.Add('Column');
with Items do
begin
h := AddItem('Project A');
AddBar(InsertItem(h,Null,'Item 1'),'Task','10/7/2020','10/14/2020',Null,Null);
AddBar(InsertItem(h,Null,'Item 2'),'Task','10/10/2020','10/17/2020',Null,Null);
ExpandItem[h] := True;
h := AddItem('Project B');
AddBar(InsertItem(h,Null,'Item 1'),'C','10/13/2020','10/20/2020',Null,Null);
AddBar(InsertItem(h,Null,'Item 2'),'C','10/15/2020','10/23/2020',Null,Null);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2157
|
I want to display two lines/curves in the histogram-area such as expected and actual work effor per month. How can I do that (flat)
![](images/exg2anttq2157.png)
// BarResize event - Occurs when a bar is moved or resized.
procedure TForm1.G2antt1BarResize(ASender: TObject; Item : HITEM;Key : OleVariant);
begin
with G2antt1 do
begin
with Items do
begin
ItemBar[Item,OleVariant(Key),EXG2ANTTLib_TLB.exBarEffort] := ItemBar[Item,OleVariant(Key),EXG2ANTTLib_TLB.exBarPercent];
ItemBar[Item,'C',EXG2ANTTLib_TLB.exBarEffort] := OleVariant(1);
end;
end
end;
with G2antt1 do
begin
BeginUpdate();
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Chart do
begin
FirstVisibleDate := '10/5/2020';
PaneWidth[False] := 128;
LevelCount := 2;
HistogramHeight := 96;
HistogramVisible := True;
with Bars.Add('Task%Progress') do
begin
HistogramPattern := EXG2ANTTLib_TLB.exRectangularCurve;
HistogramItems := -4;
HistogramBorderSize := 1;
HistogramBorderColor := Color;
Shortcut := 'P';
Def[EXG2ANTTLib_TLB.exBarShowPercentCaption] := OleVariant(True);
end;
with Bars.Copy('Task','C') do
begin
HistogramPattern := EXG2ANTTLib_TLB.exRectangularCurve;
HistogramColor := $ff;
HistogramBorderSize := 2;
end;
end;
(IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column).FormatColumn := '`Task ` + (1 index ``)';
with Items do
begin
h := AddItem(Null);
AddBar(h,'P','10/7/2020','10/14/2020','P',Null);
ItemBar[h,'P',EXG2ANTTLib_TLB.exBarPercent] := OleVariant(0.5);
AddBar(h,'C','10/7/2020','10/14/2020','C',Null);
ItemBar[h,'C',EXG2ANTTLib_TLB.exBarTransparent] := OleVariant(100);
GroupBars(h,'P',True,h,'C',True,Null,Null);
GroupBars(h,'P',False,h,'C',False,Null,Null);
h := AddItem(Null);
AddBar(h,'P','10/10/2020','10/17/2020','P',Null);
ItemBar[h,'P',EXG2ANTTLib_TLB.exBarPercent] := OleVariant(0.75);
AddBar(h,'C','10/10/2020','10/17/2020','C',Null);
ItemBar[h,'C',EXG2ANTTLib_TLB.exBarTransparent] := OleVariant(100);
GroupBars(h,'P',True,h,'C',True,Null,Null);
GroupBars(h,'P',False,h,'C',False,Null,Null);
h := AddItem(Null);
AddBar(h,'P','10/13/2020','10/20/2020','P',Null);
ItemBar[h,'P',EXG2ANTTLib_TLB.exBarPercent] := OleVariant(0.25);
AddBar(h,'C','10/13/2020','10/20/2020','C',Null);
ItemBar[h,'C',EXG2ANTTLib_TLB.exBarTransparent] := OleVariant(100);
GroupBars(h,'P',True,h,'C',True,Null,Null);
GroupBars(h,'P',False,h,'C',False,Null,Null);
end;
EndUpdate();
end
|
2156
|
Is it possible to show the filterbar on top of the rows
![](images/exg2anttq2156.png)
with G2antt1 do
begin
BeginUpdate();
FilterBarPromptVisible := EXG2ANTTLib_TLB.exFilterBarTop;
HeaderHeight := 24;
FilterBarHeight := HeaderHeight;
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesGeometric;
with (IUnknown(Columns.Add('Column')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
FilterType := EXG2ANTTLib_TLB.exPattern;
Filter := 'B*';
end;
with (IUnknown(Columns.Add('Index')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 index ``';
Position := 0;
Width := 48;
AllowSizing := False;
SortType := EXG2ANTTLib_TLB.SortNumeric;
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with Items do
begin
AddItem('A.1');
AddItem('A.2');
AddItem('B.1');
AddItem('B.2');
AddItem('B.3');
AddItem('C');
end;
ApplyFilter();
EndUpdate();
end
|
2155
|
The deadline symbol is now a white arrow and it is difficult to see. I want to create a green or black arrow for showing deadline
![](images/exg2anttq2155.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
with Chart do
begin
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 96;
with Bars.Item['Deadline'] do
begin
StartColor := $8000;
StartShape := EXG2ANTTLib_TLB.exShapeIconDown3;
end;
end;
with Items do
begin
AddBar(AddItem('Task'),'Deadline','1/2/2001','1/2/2001',Null,Null);
end;
EndUpdate();
end
|
2154
|
DragDrop (with visual effect)
![](images/exg2anttq2154.png)
// OLEDragDrop event - Occurs when a source component is dropped onto a target component when the source component determines that a drop can occur.
procedure TForm1.G2antt1OLEDragDrop(ASender: TObject; Data : IExDataObject;var Effect : Integer;Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
// SelectItem(InsertItem(i,, Data.GetData(1))) = True
with G2antt1 do
begin
i := ItemFromPoint[-1,-1,c,hit];
with Items do
begin
ExpandItem[i] := True;
end;
end
end;
// OLEStartDrag event - Occurs when the OLEDrag method is called.
procedure TForm1.G2antt1OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer);
begin
// Data.SetData(Me.Items.CellCaption(FocusItem, 0), 1)
with G2antt1 do
begin
AllowedEffects := 1;
end
end;
with G2antt1 do
begin
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABPUIQAAYAQGKIcBiAKBQAGaAoDgYN4MAANAwjJBMKgBBCLIxhEYobgmGIaRjEEQDCKYcxHCaIBiGcaIfDEBIeSBHcgRbAcOQHGSZZBhGRJGj' +
'uKIbSrLICzBDUcRnGwAKQoaaaEomHwyAZOYwDAIoWhpKKCKjqWJKNb+XgAAJTES0RRVRTNAZ1YghGAQgIA==');
Background[EXG2ANTTLib_TLB.exListOLEDropPosition] := $1000000;
Background[EXG2ANTTLib_TLB.exChartOLEDropPosition] := $1;
Background[EXG2ANTTLib_TLB.exDragDropBefore] := $0;
Background[EXG2ANTTLib_TLB.exDragDropAfter] := $ffffff;
OLEDropMode := EXG2ANTTLib_TLB.exOLEDropManual;
AutoDrag := EXG2ANTTLib_TLB.exAutoDragPositionAnyOnRight;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
Indent := 16;
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
Columns.Add('Default');
with Items do
begin
h := AddItem('Root');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
end;
OutputDebugString( 'You can:' );
OutputDebugString( 'A) left-click to drag and drop items between controls (open a new exhelper and run the same sample)' );
OutputDebugString( 'B) right-click to re-arrange the item position inside the same control' );
OutputDebugString( 'This sample shows how you can insert the data being dropped as a child of the item being hovered.' );
end
|
2153
|
DragDrop (with no visual effect, hide item while drag and drop)
![](images/exg2anttq2153.png)
// OLEDragDrop event - Occurs when a source component is dropped onto a target component when the source component determines that a drop can occur.
procedure TForm1.G2antt1OLEDragDrop(ASender: TObject; Data : IExDataObject;var Effect : Integer;Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
// SelectItem(InsertItem(i,, Data.GetData(1))) = True
with G2antt1 do
begin
i := ItemFromPoint[-1,-1,c,hit];
with Items do
begin
ExpandItem[i] := True;
end;
end
end;
// OLEStartDrag event - Occurs when the OLEDrag method is called.
procedure TForm1.G2antt1OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer);
begin
// Data.SetData(Me.Items.CellCaption(FocusItem, 0), 1)
with G2antt1 do
begin
AllowedEffects := 1;
end
end;
with G2antt1 do
begin
Background[EXG2ANTTLib_TLB.exDragDropBefore] := $0;
Background[EXG2ANTTLib_TLB.exDragDropAfter] := $ffffff;
OLEDropMode := EXG2ANTTLib_TLB.exOLEDropManual;
AutoDrag := EXG2ANTTLib_TLB.exAutoDragPositionAnyOnRight;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
Indent := 16;
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
Columns.Add('Default');
with Items do
begin
h := AddItem('Root');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
end;
OutputDebugString( 'You can:' );
OutputDebugString( 'A) left-click to drag and drop items between controls (open a new exhelper and run the same sample)' );
OutputDebugString( 'B) right-click to re-arrange the item position inside the same control' );
OutputDebugString( 'This sample shows how you can insert the data being dropped as a child of the item being hovered.' );
end
|
2152
|
DragDrop
![](images/exg2anttq2152.png)
// OLEDragDrop event - Occurs when a source component is dropped onto a target component when the source component determines that a drop can occur.
procedure TForm1.G2antt1OLEDragDrop(ASender: TObject; Data : IExDataObject;var Effect : Integer;Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
// SelectItem(InsertItem(i,, Data.GetData(1))) = True
with G2antt1 do
begin
i := ItemFromPoint[-1,-1,c,hit];
with Items do
begin
ExpandItem[i] := True;
end;
end
end;
// OLEStartDrag event - Occurs when the OLEDrag method is called.
procedure TForm1.G2antt1OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer);
begin
// Data.SetData(Me.Items.CellCaption(FocusItem, 0), 1)
with G2antt1 do
begin
AllowedEffects := 1;
end
end;
with G2antt1 do
begin
OLEDropMode := EXG2ANTTLib_TLB.exOLEDropManual;
AutoDrag := EXG2ANTTLib_TLB.exAutoDragPositionAnyOnRight;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
Indent := 16;
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
Columns.Add('Default');
with Items do
begin
h := AddItem('Root');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
end;
OutputDebugString( 'You can:' );
OutputDebugString( 'A) left-click to drag and drop items between controls (open a new exhelper and run the same sample)' );
OutputDebugString( 'B) right-click to re-arrange the item position inside the same control' );
OutputDebugString( 'This sample shows how you can insert the data being dropped as a child of the item being hovered.' );
end
|
2151
|
Is there anyway to stop the header changing colour when the mouse hovers/moves across the column header (non-clickable)
![](images/exg2anttq2151.png)
with G2antt1 do
begin
BeginUpdate();
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Columns do
begin
Add('Item');
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
Position := 0;
Width := 32;
AllowSizing := False;
FormatColumn := '1 index ``';
AllowSort := False;
AllowDragging := False;
end;
end;
with Items do
begin
AddItem('Item A');
AddItem('Item B');
AddItem('Item C');
end;
EndUpdate();
end
|
2150
|
Is there anyway to stop the header changing colour when the mouse hovers/moves across the column header
![](images/exg2anttq2150.png)
with G2antt1 do
begin
BeginUpdate();
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
Background[EXG2ANTTLib_TLB.exCursorHoverColumn] := $ffffffff;
with Columns do
begin
Add('Item');
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
Position := 0;
Width := 32;
AllowSizing := False;
FormatColumn := '1 index ``';
AllowSort := False;
AllowDragging := False;
end;
end;
with Items do
begin
AddItem('Item A');
AddItem('Item B');
AddItem('Item C');
end;
EndUpdate();
end
|
2149
|
How can I detect the last visible item
// SelectionChanged event - Fired after a new item has been selected.
procedure TForm1.G2antt1SelectionChanged(ASender: TObject; );
begin
with G2antt1 do
begin
with Items do
begin
OutputDebugString( NextVisibleItem[FocusItem] );
end;
end
end;
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
AutoDrag := EXG2ANTTLib_TLB.exAutoDragPositionAny;
Columns.Add('Column');
with Items do
begin
InsertItem(AddItem('Item 1'),Null,'Child 1');
AddItem('Item 2');
AddItem('Item 3');
InsertItem(AddItem('Item 4'),Null,'Child 4');
AddItem('Item 5');
end;
EndUpdate();
end
|
2148
|
Is it possible to show the non-working part on the back (behind the item's background)
![](images/exg2anttq2148.png)
// CellStateChanged event - Fired after cell's state has been changed.
procedure TForm1.G2antt1CellStateChanged(ASender: TObject; Item : HITEM;ColIndex : Integer);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exGroupLinesOutside;
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
DefaultItemHeight := 22;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesSolid;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with (IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
with VisualAppearance do
begin
Add(2,'gBFLBCJwBAEHhEJAAEhABUkIQAAYAQGKIcBiAKBQAGYBIJDEMQ3DjAUBjMK4ZwTC4AIQjCK4JDKHYJRpHEZgLBMJAAGIZYhhUYRUiYMkiJBGGDIDiGGI2SJAcbTVIEcx' +
'9EyUJSgSTJOjCMokTTIU4TTLYASbJafJJhWSaAiyMouDIOMg1BDNIw/Hika6jOgKUisNJXRzWIBTbDlOQ3JqnbCjOQRSrQBoNDAMAiiaKlbwJPK9RoieQXfwUAJrXJcF' +
'qXFSLVxNBKAQEBA=');
Add(4,'gBFLBCJwBAEHhEJAAEhABTcIQAAYAQGKIcBiAKBQAGaAoDgYN4MAANAwjJBMKgBBCLIxhEYobgmGIaRiBMIxAKIZhzEiJYgGIZxYh8MQER5IEbyBDsBw5AaZZojGRJGi' +
'gNIqSxLUhTRKUdQrG4AKQnGhpDgmJYnU5EcrSUKQcw/JaiKYpGZYXpqO5OTzUIyVHDdKgFGKNKwjKiKKp6FofDJcADUcKAYBKFoaLjgS5bXhSGpnV5bFoWdLTVwhBKAQ' +
'EBA=');
Add(1,'CP:2 1 1 -1 -1');
Add(3,'CP:4 1 1 -1 -1');
end;
with ConditionalFormats.Add('%CS0 = 1',Null) do
begin
BackColor := $3000000;
ChartBackColor := BackColor;
end;
with Chart do
begin
FirstVisibleDate := '8/1/2017';
LevelCount := 2;
PaneWidth[False] := 128;
Bars.Item['Task'].Pattern := EXG2ANTTLib_TLB.exPatternSolid;
with Bars.Item['Summary'] do
begin
StartShape := EXG2ANTTLib_TLB.exShapeIconEmpty;
EndShape := EXG2ANTTLib_TLB.exShapeIconEmpty;
Shape := EXG2ANTTLib_TLB.exShapeSolidDown;
end;
SelBackColor := G2antt1.SelBackColor;
SelBarColor := $808080;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
NonworkingDaysPattern := EXG2ANTTLib_TLB.exPatternSolid;
GridLineStyle := Integer(EXG2ANTTLib_TLB.exGridLinesBehind) Or Integer(EXG2ANTTLib_TLB.exGridLinesSolid);
end;
with Items do
begin
h := AddItem('Project');
hChild := InsertItem(h,Null,'Task 1');
AddBar(hChild,'Task','8/2/2017','8/8/2017',Null,Null);
SelectItem[hChild] := True;
hChild := InsertItem(h,Null,'Task 2');
AddBar(hChild,'Task','8/3/2017','8/10/2017',Null,Null);
hChild := InsertItem(h,Null,'Task 3');
AddBar(hChild,'Task','8/4/2017','8/12/2017',Null,Null);
CellState[OleVariant(hChild),OleVariant(0)] := 1;
hChild := InsertItem(h,Null,'Task 4');
AddBar(hChild,'Task','8/5/2017','8/14/2017',Null,Null);
hChild := InsertItem(h,Null,'Task 5');
AddBar(hChild,'Task','8/6/2017','8/16/2017',Null,Null);
AddBar(h,'Summary','8/1/2017','8/1/2017','sum',Null);
DefineSummaryBars(h,'sum',-3,'');
ExpandItem[h] := True;
h := AddItem('ItemBackColor');
AddBar(h,'Progress','8/4/2017','8/14/2017',Null,Null);
ItemBackColor[h] := $18080ff;
G2antt1.Chart.ItemBackColor[h] := $18080ff;
end;
EndUpdate();
end
|
2147
|
How can I hide a bar within the control's overview (sample 1)
![](images/exg2anttq2147.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Default');
Background[EXG2ANTTLib_TLB.exSplitBar] := $bebebe;
BackColorLevelHeader := BackColor;
with Chart do
begin
LevelCount := 2;
PaneWidth[False] := 64;
OverviewHeight := 48;
OverviewVisible := Integer(EXG2ANTTLib_TLB.exOverviewSplitter) Or Integer(EXG2ANTTLib_TLB.exOverviewShowMargins) Or Integer(EXG2ANTTLib_TLB.exOverviewShowAllVisible);
FirstVisibleDate := '1/1/2020';
Bars.Copy('Task','TaskO').Color := $ff;
end;
with Items do
begin
AddItem('');
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
h := AddItem('');
AddBar(h,'TaskO','1/2/2020','1/12/2020','K1',Null);
ItemBar[h,'K1',EXG2ANTTLib_TLB.exBarOverviewColor] := OleVariant(-1);
AddBar(h,'TaskO','12/2/2020','12/12/2020','K2',Null);
ItemBar[h,'K2',EXG2ANTTLib_TLB.exBarOverviewColor] := OleVariant(-1);
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
end;
EndUpdate();
end
|
2146
|
How can I hide all bars within the control's overview (sample 2)
![](images/exg2anttq2146.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Default');
Background[EXG2ANTTLib_TLB.exSplitBar] := $bebebe;
BackColorLevelHeader := BackColor;
with Chart do
begin
LevelCount := 2;
PaneWidth[False] := 64;
OverviewHeight := 48;
OverviewVisible := Integer(EXG2ANTTLib_TLB.exOverviewShowMargins) Or Integer(EXG2ANTTLib_TLB.exOverviewHideBars) Or Integer(EXG2ANTTLib_TLB.exOverviewShowOnlyVisible);
FirstVisibleDate := '1/1/2020';
with Bars.Copy('Task','TaskO') do
begin
OverviewColor := $ffffffff;
Color := $ff;
end;
end;
with Items do
begin
AddItem('');
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
h := AddItem('');
AddBar(h,'TaskO','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'TaskO','12/2/2020','12/12/2020','K2',Null);
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
end;
EndUpdate();
end
|
2145
|
How can I hide all bars or specified type within the control's overview (sample 3)
![](images/exg2anttq2145.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Default');
Background[EXG2ANTTLib_TLB.exSplitBar] := $bebebe;
BackColorLevelHeader := BackColor;
with Chart do
begin
LevelCount := 2;
PaneWidth[False] := 64;
OverviewHeight := 48;
OverviewVisible := Integer(EXG2ANTTLib_TLB.exOverviewSplitter) Or Integer(EXG2ANTTLib_TLB.exOverviewShowMargins) Or Integer(EXG2ANTTLib_TLB.exOverviewShowAllVisible);
FirstVisibleDate := '1/1/2020';
with Bars.Copy('Task','TaskO') do
begin
OverviewColor := $ffffffff;
Color := $ff;
end;
end;
with Items do
begin
AddItem('');
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
h := AddItem('');
AddBar(h,'TaskO','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'TaskO','12/2/2020','12/12/2020','K2',Null);
h := AddItem('');
AddBar(h,'Task','1/2/2020','1/12/2020','K1',Null);
AddBar(h,'Task','12/2/2020','12/12/2020','K2',Null);
end;
EndUpdate();
end
|
2144
|
Is it possible to exclude the parent/child items when do the filtering, so to include only items that match the filter without any indentation
![](images/exg2anttq2144.png)
// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TForm1.G2antt1AddItem(ASender: TObject; Item : HITEM);
begin
with G2antt1 do
begin
Items.AddBar(Item,'Task','1/2/2001','1/9/2001',Null,Null);
end
end;
// FilterChange event - Occurs when the filter was changed.
procedure TForm1.G2antt1FilterChange(ASender: TObject; );
begin
with G2antt1 do
begin
Indent := G2antt1.FormatABC('value > 0 ? 18 : 0',Items.MatchItemCount,Null,Null);
end
end;
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
Indent := 18;
FilterInclude := EXG2ANTTLib_TLB.exMatchingItemsOnly;
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
with Chart do
begin
LevelCount := 2;
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 164;
end;
with Columns do
begin
with (IUnknown(Add('Column')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
FilterType := EXG2ANTTLib_TLB.exFilter;
FilterList := EXG2ANTTLib_TLB.exShowCheckBox;
Filter := 'C1';
end;
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 rindex ``';
Position := 0;
AllowSizing := False;
AllowDragging := False;
end;
end;
with Items do
begin
h := AddItem('R1');
h2 := InsertItem(h,Null,'S');
InsertItem(h2,Null,'C1');
InsertItem(h2,Null,'C2');
InsertItem(h,Null,'C1');
InsertItem(h,Null,'C2');
ExpandItem[h] := True;
h := AddItem('R2');
InsertItem(h,Null,'C1');
InsertItem(h,Null,'C2');
end;
ApplyFilter();
EndUpdate();
end
|
2143
|
I am using the Chart.AllowResizeChart property. How can I customize the labels into the chart's levels
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
with Chart do
begin
AllowResizeChart := Integer(EXG2ANTTLib_TLB.exAllowChangeUnitScale) Or Integer(EXG2ANTTLib_TLB.exAllowResizeChartMiddle) Or Integer(EXG2ANTTLib_TLB.exAllowResizeChartHeader);
Label[EXG2ANTTLib_TLB.exYear] := 'year';
Label[EXG2ANTTLib_TLB.exHalfYear] := '';
Label[EXG2ANTTLib_TLB.exQuarterYear] := '';
Label[EXG2ANTTLib_TLB.exMonth] := 'month';
Label[EXG2ANTTLib_TLB.exThirdMonth] := '';
Label[EXG2ANTTLib_TLB.exWeek] := 'week';
Label[EXG2ANTTLib_TLB.exDay] := 'day';
Label[EXG2ANTTLib_TLB.exHour] := 'hour';
Label[EXG2ANTTLib_TLB.exMinute] := '';
Label[EXG2ANTTLib_TLB.exSecond] := '';
ShowNonworkingDates := False;
LevelCount := 2;
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 48;
UnitWidth := 32;
UnitScale := EXG2ANTTLib_TLB.exDay;
end;
with Items do
begin
AddBar(AddItem('Task A'),'Task','1/2/2001','1/6/2001','K1',Null);
AddBar(AddItem('Task B'),'Task','1/6/2001','1/10/2001','K1',Null);
AddBar(AddItem('Task C'),'Task','1/10/2001','1/14/2001','K1',Null);
AddBar(AddItem(''),'','1/8/2001','1/8/2001','Info','Click the <b>middle</b> mouse button and start dragging');
end;
EndUpdate();
end
|
2142
|
Is it possible to display the header using multiple lines, while chart display multiple levels (sample 2)
![](images/exg2anttq2142.png)
// AddColumn event - Fired after a new column has been added.
procedure TForm1.G2antt1AddColumn(ASender: TObject; Column : IColumn);
begin
// Column.Def(52) = 4
// Column.Def(53) = 4
end;
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
LevelCount := 2;
PaneWidth[True] := 256;
end;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
with Columns do
begin
Add('Column');
(IUnknown(Add('C1')) as EXG2ANTTLib_TLB.Column).HTMLCaption := '<b>C<off 4>1</b><br>left';
(IUnknown(Add('C2')) as EXG2ANTTLib_TLB.Column).HTMLCaption := '<c><b>C<off 4>2</b><br><c>center';
(IUnknown(Add('C3')) as EXG2ANTTLib_TLB.Column).HTMLCaption := '<r><b>C<off 4>3</b><br><r>right';
end;
EndUpdate();
end
|
2141
|
Is there any way to control the z-order of a TimeZone
![](images/exg2anttq2141.png)
with G2antt1 do
begin
with Chart do
begin
PaneWidth[False] := 0;
UnitWidth := 15;
LevelCount := 2;
FirstVisibleDate := '12/28/2009';
MarkTimeZone('Top','1/1/2010','1/5/2010',OleVariant(16711680),'1;;<fgcolor=FFFFFF>Top;1');
MarkTimeZone('Partial','1/8/2010','1/12/2010',OleVariant(16711680),'50;;<fgcolor=FFFFFF>Partial;1');
MarkTimeZone('Default','1/15/2010','1/19/2010',OleVariant(16711680),';;<fgcolor=FFFFFF>Default;1');
end;
end
|
2140
|
Is it possible to display the header using multiple lines, while chart display multiple levels (sample 1)
![](images/exg2anttq2140.png)
with G2antt1 do
begin
BeginUpdate();
Chart.LevelCount := 2;
HeaderHeight := 18;
HeaderSingleLine := False;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
(IUnknown(Columns.Add('This is just a column that should break the header.')) as EXG2ANTTLib_TLB.Column).Width := 32;
Columns.Add('This is just another column that should break the header.');
EndUpdate();
end
|
2139
|
Difference between HistogramValueFromPoint and HistogramValue (sample 2)
![](images/exg2anttq2139.png)
// MouseMove event - Occurs when the user moves the mouse.
procedure TForm1.G2antt1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
with G2antt1 do
begin
with Chart do
begin
v1 := HistogramValueFromPoint[-1,-1];
v2 := HistogramValue[OleVariant(DateFromPoint[-1,-1]),Null,Null];
vMin := HistogramValue['min',Null,Null];
vMax := HistogramValue['max',Null,Null];
end;
format := FormatABC('`<b>ValueFromPoint</b>: ` + A + `<br>ValueFromDate: ` + B',OleVariant(v1),OleVariant(v2),Null);
format := FormatABC('A + `<br>Min: ` + B + `<br>Max: ` + C',OleVariant(format),OleVariant(vMin),OleVariant(vMax));
ShowToolTip(format,Null,Null,'16','16');
end
end;
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstWeekDay := EXG2ANTTLib_TLB.exMonday;
LevelCount := 2;
PaneWidth[False] := 40;
FirstVisibleDate := '6/9/2005';
HistogramVisible := True;
HistogramView := Integer(EXG2ANTTLib_TLB.exHistogramGroupCumulative) Or Integer(EXG2ANTTLib_TLB.exHistogramAllItems);
HistogramHeight := 128;
with Bars.Item['Task'] do
begin
HistogramPattern := Pattern;
HistogramType := EXG2ANTTLib_TLB.exHistCumulative;
HistogramItems := -6;
HistogramRulerLinesColor := $10000;
HistogramBorderSize := 1;
HistogramBorderColor := $10000;
HistogramCumulativeOriginalColorBars := EXG2ANTTLib_TLB.exChangeColor;
HistogramCumulativeShowLegend := -1;
end;
end;
with Items do
begin
AddBar(AddItem('Task'),'Task','6/10/2005','6/14/2005','',Null);
AddBar(AddItem('Task'),'Task','6/11/2005','6/15/2005','',Null);
AddBar(AddItem('Task'),'Task','6/12/2005','6/16/2005','',Null);
end;
EndUpdate();
end
|
2138
|
Difference between HistogramValueFromPoint and HistogramValue (sample 1)
![](images/exg2anttq2138.png)
// MouseMove event - Occurs when the user moves the mouse.
procedure TForm1.G2antt1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
with G2antt1 do
begin
with Chart do
begin
v1 := HistogramValueFromPoint[-1,-1];
v2 := HistogramValue[OleVariant(DateFromPoint[-1,-1]),Null,Null];
vMin := HistogramValue['min',Null,Null];
vMax := HistogramValue['max',Null,Null];
end;
format := FormatABC('`<b>ValueFromPoint</b>: ` + A + `<br>ValueFromDate: ` + B',OleVariant(v1),OleVariant(v2),Null);
format := FormatABC('A + `<br>Min: ` + B + `<br>Max: ` + C',OleVariant(format),OleVariant(vMin),OleVariant(vMax));
ShowToolTip(format,Null,Null,'16','16');
end
end;
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstWeekDay := EXG2ANTTLib_TLB.exMonday;
LevelCount := 2;
PaneWidth[False] := 40;
FirstVisibleDate := '6/9/2005';
HistogramVisible := True;
HistogramView := EXG2ANTTLib_TLB.exHistogramAllItems;
HistogramHeight := 128;
with Bars.Item['Task'] do
begin
HistogramPattern := Pattern;
HistogramType := EXG2ANTTLib_TLB.exHistOverload;
HistogramItems := -6;
HistogramRulerLinesColor := $10000;
HistogramBorderSize := 1;
HistogramBorderColor := $10000;
end;
end;
with Items do
begin
AddBar(AddItem('Task'),'Task','6/10/2005','6/14/2005','',Null);
AddBar(AddItem('Task'),'Task','6/11/2005','6/15/2005','',Null);
AddBar(AddItem('Task'),'Task','6/12/2005','6/16/2005','',Null);
end;
EndUpdate();
end
|
2137
|
I am using the Inside-Zoom feature, but the inside grid lines are more dashed the dotted
![](images/exg2anttq2137.png)
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
UnitScale := EXG2ANTTLib_TLB.exDay;
PaneWidth[False] := 0;
LevelCount := 2;
FirstVisibleDate := '1/1/2008';
with DefaultInsideZoomFormat do
begin
InsideLabel := '<%hh%>';
InsideUnit := EXG2ANTTLib_TLB.exHour;
InsideCount := 8;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesGeometric;
end;
AllowInsideZoom := True;
with InsideZooms do
begin
Add('1/4/2008');
end;
DrawGridLines := EXG2ANTTLib_TLB.exVLines;
ShowNonworkingDates := False;
end;
EndUpdate();
end
|
2136
|
I am using expressions for exBarEffort, but the histogram does not show correctly the data
![](images/exg2anttq2136.png)
with G2antt1 do
begin
BeginUpdate();
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Chart do
begin
FirstVisibleDate := '10/5/2020';
PaneWidth[False] := 128;
LevelCount := 2;
HistogramHeight := 96;
HistogramVisible := True;
AllowInsideZoom := True;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
with InsideZooms.Add('10/7/2020') do
begin
Width := 196;
end;
DefaultInsideZoomFormat.GridLineStyle := EXG2ANTTLib_TLB.exGridLinesSolid;
with Bars.Item['Task'] do
begin
HistogramPattern := Pattern;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
Def[EXG2ANTTLib_TLB.exBarEffort] := '(hour(value) > 5 and hour(value) < 18) ? 2 : 0';
end;
HistogramUnitScale := EXG2ANTTLib_TLB.exHour;
end;
(IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column).FormatColumn := '`Task ` + (1 index ``)';
with Items do
begin
AddBar(AddItem(''),'Task','10/7/2020','10/12/2020',Null,Null);
AddBar(AddItem(''),'Task','10/8/2020','10/13/2020',Null,Null);
end;
EndUpdate();
end
|
2135
|
How can I specify the z-order of bars to be shown within the chart's histogram
![](images/exg2anttq2135.png)
with G2antt1 do
begin
BeginUpdate();
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Chart do
begin
FirstVisibleDate := '10/5/2020';
PaneWidth[False] := 128;
LevelCount := 2;
HistogramHeight := 96;
HistogramVisible := True;
with Bars.Add('A') do
begin
Color := $ff0000;
HistogramPattern := EXG2ANTTLib_TLB.exPatternSolid;
HistogramItems := -6;
HistogramCumulativeOriginalColorBars := EXG2ANTTLib_TLB.exKeepOriginalColor;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
end;
with Bars.Copy('A','B') do
begin
Color := $ff00;
HistogramCumulativeOriginalColorBars := EXG2ANTTLib_TLB.exKeepOriginalColor;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
end;
HistogramView := Integer(EXG2ANTTLib_TLB.exHistogramGroupCumulative) Or Integer(EXG2ANTTLib_TLB.exHistogramAllItems);
HistogramZOrder := 'A,B';
end;
(IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column).FormatColumn := '`Task ` + (1 index ``)';
with Items do
begin
AddBar(AddItem(''),'A','10/7/2020','10/12/2020',Null,Null);
AddBar(AddItem(''),'A','10/8/2020','10/13/2020',Null,Null);
AddBar(AddItem(''),'B','10/9/2020','10/14/2020',Null,Null);
AddBar(AddItem(''),'B','10/10/2020','10/15/2020',Null,Null);
end;
EndUpdate();
end
|
2134
|
How can I show cumulative histogram for two or more different types of bars
![](images/exg2anttq2134.png)
with G2antt1 do
begin
BeginUpdate();
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Chart do
begin
FirstVisibleDate := '10/5/2020';
PaneWidth[False] := 128;
LevelCount := 2;
HistogramHeight := 96;
HistogramVisible := True;
with Bars.Add('A') do
begin
Color := $ff0000;
HistogramPattern := EXG2ANTTLib_TLB.exPatternSolid;
HistogramItems := -6;
HistogramCumulativeOriginalColorBars := EXG2ANTTLib_TLB.exKeepOriginalColor;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
end;
with Bars.Copy('A','B') do
begin
Color := $ff00;
HistogramCumulativeOriginalColorBars := EXG2ANTTLib_TLB.exKeepOriginalColor;
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
end;
HistogramView := Integer(EXG2ANTTLib_TLB.exHistogramGroupCumulative) Or Integer(EXG2ANTTLib_TLB.exHistogramAllItems);
end;
(IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column).FormatColumn := '`Task ` + (1 index ``)';
with Items do
begin
AddBar(AddItem(''),'A','10/7/2020','10/12/2020',Null,Null);
AddBar(AddItem(''),'A','10/8/2020','10/13/2020',Null,Null);
AddBar(AddItem(''),'B','10/9/2020','10/14/2020',Null,Null);
AddBar(AddItem(''),'B','10/10/2020','10/15/2020',Null,Null);
end;
EndUpdate();
end
|
2133
|
I would like to display a solid line between "root" items, and dotted lines (default) between child items. How can I do that
![](images/exg2anttq2133.png)
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
DrawGridLines := EXG2ANTTLib_TLB.exHLines;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesGeometric;
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABMsIQAAYAQGKIcBiAKBQAGaAoDgYN4MAANAwjJBMKgBBCLIxhEYobgmGIXRpFMbxAKQahLEiTIgGUYJHgmK4tQLHb7zGAABRDDSOIDnGQJXh' +
'aI4JQSMMQDGLAZxVFiPRhAWLpBh+PQATrOdLUfSjVwhBKAQEBA==');
with (IUnknown(Columns.Add('Default')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
with (IUnknown(Columns.Add('Position')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '((1 rindex ``) contains `.`) = 0';
Visible := False;
end;
with ConditionalFormats.Add('%C1',Null) do
begin
BackColor := $1e0e0e0;
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
InsertItem(h,Null,'Child 3');
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
h := AddItem('Root 3');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
end;
EndUpdate();
end
|
2132
|
I can not center or align the cell's caption and icon, when it displays the hierarchy
![](images/exg2anttq2132.png)
with G2antt1 do
begin
BeginUpdate();
Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' +
'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' +
'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' +
'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=');
with (IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellValueFormat] := OleVariant(1);
end;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
with Items do
begin
h := AddItem('Project');
hChild := InsertItem(h,Null,'<img>1</img> Task (left)');
hChild := InsertItem(h,Null,'<c><img>2</img> Task (center)');
hChild := InsertItem(h,Null,'<r>Task (right) <img>3</img>');
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2131
|
How do I mask for float/integer number
![](images/exg2anttq2131.png)
with G2antt1 do
begin
BeginUpdate();
ColumnAutoResize := True;
(IUnknown(Columns.Add('Type')) as EXG2ANTTLib_TLB.Column).Width := 32;
Columns.Add('Editor');
with Items do
begin
h := AddItem('Integer');
CellValue[OleVariant(h),OleVariant(1)] := '12';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Numeric := EXG2ANTTLib_TLB.exInteger;
end;
h := AddItem('Integer (mask, group)');
CellValue[OleVariant(h),OleVariant(1)] := '10002';
FormatCell[OleVariant(h),OleVariant(1)] := 'value format `0||`';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.MaskType;
Mask := ';;;float,digits=0,invalid=empty,warning=invalid character';
end;
h := AddItem('Integer (mask, no group)');
CellValue[OleVariant(h),OleVariant(1)] := '10002';
FormatCell[OleVariant(h),OleVariant(1)] := 'value format `0|0|`';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.MaskType;
Mask := ';;;float,digits=0,grouping=,invalid=empty,warning=invalid character';
end;
h := AddItem('Float');
CellValue[OleVariant(h),OleVariant(1)] := '+12.34E+2';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Numeric := EXG2ANTTLib_TLB.exFloat;
end;
h := AddItem('Float (no signs)');
CellValue[OleVariant(h),OleVariant(1)] := '12.34E-2';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Numeric := Integer(EXG2ANTTLib_TLB.exDisableSigns) Or Integer(EXG2ANTTLib_TLB.exFloat);
end;
h := AddItem('Float-Integer');
CellValue[OleVariant(h),OleVariant(1)] := '+12.34';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Numeric := EXG2ANTTLib_TLB.exFloatInteger;
end;
h := AddItem('Float-Integer (no signs)');
CellValue[OleVariant(h),OleVariant(1)] := '12.34';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.EditType;
Numeric := Integer(EXG2ANTTLib_TLB.exDisableSigns) Or Integer(EXG2ANTTLib_TLB.exFloatInteger);
end;
h := AddItem('Float (mask,group)');
CellValue[OleVariant(h),OleVariant(1)] := '10002.34';
FormatCell[OleVariant(h),OleVariant(1)] := 'value format `2`';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.MaskType;
Mask := ';;;float,invalid=empty,warning=invalid character';
end;
h := AddItem('Float (mask, no group)');
CellValue[OleVariant(h),OleVariant(1)] := '10002.34';
FormatCell[OleVariant(h),OleVariant(1)] := 'value format `2|0|`';
with CellEditor[OleVariant(h),OleVariant(1)] do
begin
EditType := EXG2ANTTLib_TLB.MaskType;
Mask := ';;;float,grouping=,invalid=empty,warning=invalid character';
end;
end;
EndUpdate();
end
|
2130
|
Is it possible to offset (horizontally) the bar's caption
![](images/exg2anttq2130.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('HOffset');
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
ScrollBySingleLine := True;
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
with Chart do
begin
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
FirstVisibleDate := '12/16/2000';
LevelCount := 2;
PaneWidth[False] := 128;
with Bars.Item['Task'] do
begin
Pattern := EXG2ANTTLib_TLB.exPatternBox;
Color := $a4a4a4;
StartColor := $f0f0f0;
EndColor := StartColor;
Height := 15;
Def[EXG2ANTTLib_TLB.exBarCaption] := 'label';
end;
end;
with Items do
begin
h := AddItem('right');
AddBar(h,'Task','12/22/2000','12/27/2000',Null,Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(2);
h := AddItem('right - 4');
AddBar(h,'Task','12/22/2000','12/27/2000',Null,Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(2);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaptionHOffset] := OleVariant(-4);
h := AddItem('left');
AddBar(h,'Task','12/22/2000','12/27/2000',Null,Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(0);
h := AddItem('left + 4');
AddBar(h,'Task','12/22/2000','12/27/2000',Null,Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(0);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarCaptionHOffset] := OleVariant(4);
end;
EndUpdate();
end
|
2129
|
Is it possible to always center the bar's caption (even if the item-bar is partially visible)
![](images/exg2anttq2129.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Align');
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
ScrollBySingleLine := True;
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
with Chart do
begin
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
FirstVisibleDate := '12/23/2000';
LevelCount := 2;
PaneWidth[False] := 128;
with Bars.Item['Task'] do
begin
Pattern := EXG2ANTTLib_TLB.exPatternBox;
Color := $a4a4a4;
StartColor := $f0f0f0;
EndColor := StartColor;
Height := 15;
end;
end;
with Items do
begin
h := AddItem('default');
AddBar(h,'Task','12/22/2000','12/27/2000','','label');
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(1);
h := AddItem('default + 32');
AddBar(h,'Task','12/22/2000','12/27/2000','','label');
ItemBar[h,'',EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(33);
end;
EndUpdate();
end
|
2128
|
How do I set an extra data for each item
// MouseMove event - Occurs when the user moves the mouse.
procedure TForm1.G2antt1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer);
begin
with G2antt1 do
begin
i := ItemFromPoint[-1,-1,c,hit];
OutputDebugString( i );
OutputDebugString( Items.ItemData[i] );
end
end;
with G2antt1 do
begin
BeginUpdate();
ColumnAutoResize := True;
Columns.Add('Default');
with Items do
begin
ItemData[AddItem('method 1')] := 'your extra data of method 1';
InsertItem(0,'your extra data of method 2','method 2');
end;
with Items do
begin
DefaultItem := AddItem('method 3');
ItemData[0] := 'your extra data of method 3';
end;
EndUpdate();
end
|
2127
|
Is it possible to show the position of rows the into the chart section
![](images/exg2anttq2127.png)
// BeforeExpandItem event - Fired before an item is about to be expanded (collapsed).
procedure TForm1.G2antt1BeforeExpandItem(ASender: TObject; Item : HITEM;var Cancel : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
Indent := 16;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
HasLines := EXG2ANTTLib_TLB.exSolidLine;
DrawGridLines := EXG2ANTTLib_TLB.exHLines;
ScrollBySingleLine := True;
FullRowSelect := EXG2ANTTLib_TLB.exColumnSel;
Columns.Add('Tasks');
with (IUnknown(Columns.Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
Visible := False;
FormatColumn := '`<r><bgcolor 000000><fgcolor FFFFFF> ` + 1 apos `` + ` </fgcolor></bgcolor>`';
Def[EXG2ANTTLib_TLB.exCellValueFormat] := OleVariant(1);
end;
with Chart do
begin
ColumnsFormatLevel := ',|,1:64';
FirstVisibleDate := '9/20/2006';
ShowCollapsedBars := True;
LevelCount := 2;
PaneWidth[False] := 128;
DrawGridLines := EXG2ANTTLib_TLB.exHLines;
with Bars.Item['Task'] do
begin
OverlaidType := EXG2ANTTLib_TLB.exOverlaidBarsStack;
Color := $0;
StartColor := $c4c4c4;
EndColor := $c4c4c4;
Pattern := EXG2ANTTLib_TLB.exPatternBox;
end;
end;
with Items do
begin
h := AddItem('Project 1');
h1 := InsertItem(h,Null,'Resources');
AddBar(h1,'Task','9/21/2006','9/25/2006','A',Null);
AddBar(h1,'Task','9/24/2006','9/28/2006','B',Null);
AddBar(h1,'Task','9/27/2006','9/29/2006','C',Null);
h := AddItem('Project 2');
h1 := InsertItem(h,Null,'Resources');
AddBar(h1,'Task','9/21/2006','9/25/2006','A',Null);
AddBar(h1,'Task','9/24/2006','9/28/2006','B',Null);
AddBar(h1,'Task','9/27/2006','9/29/2006','C',Null);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2126
|
I do not like to specify the item padding for every column I add. The question is how can I do it automatically
![](images/exg2anttq2126.png)
with G2antt1 do
begin
BeginUpdate();
AttachTemplate('handle AddColumn(Column){Column{Def(48)=8;Def(49)=8;AllowDragging=False;AllowSizing = True}}');
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesVSolid;
with Columns do
begin
Add('Item');
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
Position := 0;
Width := 32;
AllowSizing := False;
FormatColumn := '1 index ``';
end;
end;
with Items do
begin
AddItem('Item A');
AddItem('Item B');
AddItem('Item C');
end;
EndUpdate();
end
|
2125
|
Stack vs Cascade
![](images/exg2anttq2125.png)
with G2antt1 do
begin
BeginUpdate();
ScrollBySingleLine := True;
HeaderAppearance := EXG2ANTTLib_TLB.Flat;
Columns.Add('Type');
BackColorAlternate := RGB(240,240,240);
with Chart do
begin
LevelCount := 2;
AllowCreateBar := EXG2ANTTLib_TLB.exCreateBarAuto;
AllowLinkBars := False;
ResizeUnitScale := EXG2ANTTLib_TLB.exHour;
PaneWidth[False] := 128;
FirstVisibleDate := '1/1/2001';
Bars.Copy('Task','Stack').OverlaidType := EXG2ANTTLib_TLB.exOverlaidBarsStack;
Bars.Copy('Task','AStack').OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
Bars.Copy('Task','Cascade').OverlaidType := EXG2ANTTLib_TLB.exOverlaidBarsCascade;
end;
with Items do
begin
h := AddItem('Stack');
AddBar(h,'Stack','1/2/2001','1/4/2001','A1',Null);
AddBar(h,'Stack','1/3/2001','1/5/2001','A2',Null);
AddBar(h,'Stack','1/4/2001','1/7/2001','A3',Null);
AddBar(h,'Stack','1/2/2001','1/7/2001','A4',Null);
AddBar(h,'Stack','1/8/2001','1/12/2001','A5',Null);
AddItem(Null);
h := AddItem('Stack-AutoArrange');
AddBar(h,'AStack','1/2/2001','1/4/2001','A1',Null);
AddBar(h,'AStack','1/3/2001','1/5/2001','A2',Null);
AddBar(h,'AStack','1/4/2001','1/7/2001','A3',Null);
AddBar(h,'AStack','1/2/2001','1/7/2001','A4',Null);
AddBar(h,'AStack','1/8/2001','1/12/2001','A5',Null);
AddItem(Null);
h := AddItem('Cascade');
AddBar(h,'Cascade','1/2/2001','1/4/2001','A1',Null);
AddBar(h,'Cascade','1/3/2001','1/5/2001','A2',Null);
AddBar(h,'Cascade','1/4/2001','1/7/2001','A3',Null);
AddBar(h,'Cascade','1/2/2001','1/7/2001','A4',Null);
AddBar(h,'Cascade','1/8/2001','1/12/2001','A5',Null);
AddItem(Null);
ItemBar[0,'<*>',EXG2ANTTLib_TLB.exBarCaption] := '<%=%9%>';
end;
EndUpdate();
end
|
2124
|
How can I change the Exclude field in the drop down filter window
![](images/exg2anttq2124.png)
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
HTMLPicture['exclude'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAEAcRdrdcUQhQDOZCJJUBEjbbhJ7giIJOBILJziJvl4BeKibhDiIZOhFLB0KZvMx0O5hORlAB3owuNJuNZzMZhOBlFxvORnTb' +
'uHgaiIeKBMKhFf9fDIcEoPCAVEAlGI4HhBBYMCARCQVGg4IhVMCAWC2XY1Q7WJ8RBB0KROKYAYDBbzicjndD6fA/VsRHRJIhBkRbMYIGwGAQjA2fRYOEBoYjBFBx1ATC' +
'gCGQ8M7OTjSaJMDRDKIwYu5DrIMBgSAADKJTqhBhyRApAA3FAucZPPilokRJJFJxEVxCMCCgIA==';
Description[EXG2ANTTLib_TLB.exFilterBarExclude] := '<img>exclude</img>';
with (IUnknown(Columns.Add('Items')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
DisplayFilterPattern := False;
FilterList := Integer(EXG2ANTTLib_TLB.exShowExclude) Or Integer(EXG2ANTTLib_TLB.exShowFocusItem) Or Integer(EXG2ANTTLib_TLB.exShowCheckBox);
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
end;
EndUpdate();
end
|
2123
|
How can I change the Exclude field in the drop down filter window
![](images/exg2anttq2123.png)
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
Description[EXG2ANTTLib_TLB.exFilterBarExclude] := '<bgcolor 0><fgcolor ffffff> Exclude </fgcolor></bgcolor>';
with (IUnknown(Columns.Add('Items')) as EXG2ANTTLib_TLB.Column) do
begin
DisplayFilterButton := True;
DisplayFilterPattern := False;
FilterList := Integer(EXG2ANTTLib_TLB.exShowExclude) Or Integer(EXG2ANTTLib_TLB.exShowFocusItem) Or Integer(EXG2ANTTLib_TLB.exShowCheckBox);
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
end;
EndUpdate();
end
|
2122
|
The grid lines looks different then before. What should I do
![](images/exg2anttq2122.png)
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
with (IUnknown(Columns.Add('Tasks')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
GridLineStyle := EXG2ANTTLib_TLB.exGridLinesGeometric;
Chart.DrawGridLines := G2antt1.DrawGridLines;
Chart.GridLineStyle := G2antt1.GridLineStyle;
HeaderVisible := EXG2ANTTLib_TLB.exHeaderVisibleExtendLevels;
with Items do
begin
h := AddItem('Project');
hChild := InsertItem(h,Null,'Task 1');
SelectItem[hChild] := True;
hChild := InsertItem(h,Null,'Task 2');
CellState[OleVariant(hChild),OleVariant(0)] := 1;
hChild := InsertItem(h,Null,'Task 3');
CellState[OleVariant(hChild),OleVariant(0)] := 1;
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2121
|
How can I hide the task/bar's extra-caption
![](images/exg2anttq2121.png)
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
PaneWidth[False] := 96;
FirstVisibleDate := '1/1/2011';
with Bars.Item['Task'] do
begin
Def[EXG2ANTTLib_TLB.exBarExtraCaption] := '<%=%C0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
Def[EXG2ANTTLib_TLB.exBarExtraCaptionHAlign] := OleVariant(16);
end;
end;
Columns.Add('Task');
with (IUnknown(Columns.Add('Show')) as EXG2ANTTLib_TLB.Column) do
begin
with Editor do
begin
EditType := EXG2ANTTLib_TLB.CheckValueType;
Option[EXG2ANTTLib_TLB.exCheckValue2] := OleVariant(1);
end;
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(57);
end;
with Items do
begin
AllowCellValueToItemBar := True;
AddBar(AddItem('Task 1'),'Task','1/3/2011','1/7/2011',Null,Null);
ItemBar[FirstVisibleItem,'',EXG2ANTTLib_TLB.exBarShowExtraCaption] := OleVariant(False);
AddBar(AddItem('Task 2'),'Task','1/4/2011','1/8/2011',Null,Null);
end;
EndUpdate();
end
|
2120
|
How can I hide the task/bar's caption
![](images/exg2anttq2120.png)
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
PaneWidth[False] := 96;
FirstVisibleDate := '1/1/2011';
with Bars.Item['Task'] do
begin
Def[EXG2ANTTLib_TLB.exBarCaption] := '<%=%C0%>';
Def[EXG2ANTTLib_TLB.exBarHAlignCaption] := OleVariant(18);
end;
end;
Columns.Add('Task');
with (IUnknown(Columns.Add('Show')) as EXG2ANTTLib_TLB.Column) do
begin
with Editor do
begin
EditType := EXG2ANTTLib_TLB.CheckValueType;
Option[EXG2ANTTLib_TLB.exCheckValue2] := OleVariant(1);
end;
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(56);
end;
with Items do
begin
AllowCellValueToItemBar := True;
AddBar(AddItem('Task 1'),'Task','1/3/2011','1/7/2011',Null,Null);
ItemBar[FirstVisibleItem,'',EXG2ANTTLib_TLB.exBarShowCaption] := OleVariant(False);
AddBar(AddItem('Task 2'),'Task','1/4/2011','1/8/2011',Null,Null);
end;
EndUpdate();
end
|
2119
|
Can I sort the column by check-state
![](images/exg2anttq2119.png)
with G2antt1 do
begin
BeginUpdate();
with (IUnknown(Columns.Add('Check')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
SortType := EXG2ANTTLib_TLB.exSortByState;
end;
with Items do
begin
AddItem(Null);
CellState[OleVariant(AddItem(Null)),OleVariant(0)] := 1;
CellState[OleVariant(AddItem(Null)),OleVariant(0)] := 1;
AddItem(Null);
end;
Columns.Item[OleVariant(0)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
EndUpdate();
end
|
2118
|
Can I sort the column by image
![](images/exg2anttq2118.png)
with G2antt1 do
begin
BeginUpdate();
Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' +
'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' +
'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' +
'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=');
with (IUnknown(Columns.Add('Image')) as EXG2ANTTLib_TLB.Column) do
begin
SortType := EXG2ANTTLib_TLB.exSortByImage;
end;
with Items do
begin
CellImage[OleVariant(AddItem(Null)),OleVariant(0)] := 3;
AddItem(Null);
CellImage[OleVariant(AddItem(Null)),OleVariant(0)] := 1;
CellImage[OleVariant(AddItem(Null)),OleVariant(0)] := 2;
end;
Columns.Item[OleVariant(0)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
EndUpdate();
end
|
2117
|
Can I sort the column by value(numeric)
![](images/exg2anttq2117.png)
with G2antt1 do
begin
BeginUpdate();
with (IUnknown(Columns.Add('Value')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellValueFormat] := OleVariant(1);
FormatColumn := '`<fgcolor=808080><off 4><font ;6> ` + (1 index ``) + ` </font></off></fgcolor>` + value';
SortType := Integer(EXG2ANTTLib_TLB.exSortByValue) Or Integer(EXG2ANTTLib_TLB.SortNumeric);
end;
with Items do
begin
AddItem('1');
AddItem('10');
AddItem('2');
AddItem('20');
end;
Columns.Item[OleVariant(0)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
EndUpdate();
end
|
2116
|
Can I sort a column by cell's state (checked, unchecked) rather than caption
![](images/exg2anttq2116.png)
with G2antt1 do
begin
BeginUpdate();
with (IUnknown(Columns.Add('Check')) as EXG2ANTTLib_TLB.Column) do
begin
with Editor do
begin
EditType := EXG2ANTTLib_TLB.CheckValueType;
Option[EXG2ANTTLib_TLB.exCheckValue2] := OleVariant(1);
end;
SortType := EXG2ANTTLib_TLB.SortNumeric;
end;
with Items do
begin
AddItem(OleVariant(True));
AddItem(OleVariant(False));
AddItem(OleVariant(False));
AddItem(OleVariant(True));
end;
Columns.Item[OleVariant(0)].SortOrder := EXG2ANTTLib_TLB.SortAscending;
EndUpdate();
end
|
2115
|
How can I highlight(bold) the items that displays milestones (method 2)
![](images/exg2anttq2115.png)
with G2antt1 do
begin
BeginUpdate();
with Columns do
begin
Add('Tasks');
(IUnknown(Add('Start')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(1);
(IUnknown(Add('End')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(543);
with (IUnknown(Add('Days')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(258);
FormatColumn := 'value ? value : ``';
end;
with (IUnknown(Add('Type')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(0);
Visible := False;
end;
end;
with ConditionalFormats.Add('%4 = `Milestone`',Null) do
begin
Bold := True;
Italic := True;
ApplyTo := EXG2ANTTLib_TLB.exFormatToItems;
end;
with Chart do
begin
FirstVisibleDate := '9/20/2010';
LevelCount := 2;
PaneWidth[False] := 256;
with Bars.Add('Task:Split') do
begin
Shortcut := 'Task';
Def[EXG2ANTTLib_TLB.exBarKeepWorkingCount] := OleVariant(True);
end;
end;
with Items do
begin
AllowCellValueToItemBar := True;
AddBar(AddItem('M1'),'Milestone','9/24/2010','9/24/2010',Null,Null);
AddBar(AddItem('T1'),'Task','9/24/2010','9/28/2010',Null,Null);
AddBar(AddItem('T2'),'Task','9/27/2010','9/28/2010',Null,Null);
AddBar(AddItem('M3'),'Milestone','9/28/2010','9/28/2010',Null,Null);
end;
EndUpdate();
end
|
2114
|
How can I highlight(bold) the items that displays milestones (method 1)
![](images/exg2anttq2114.png)
with G2antt1 do
begin
BeginUpdate();
with Columns do
begin
Add('Tasks');
(IUnknown(Add('Start')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(1);
(IUnknown(Add('End')) as EXG2ANTTLib_TLB.Column).Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(543);
with (IUnknown(Add('Days')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(258);
FormatColumn := 'value ? value : ``';
end;
end;
with ConditionalFormats.Add('%3 = 0',Null) do
begin
Bold := True;
Italic := True;
ApplyTo := EXG2ANTTLib_TLB.exFormatToItems;
end;
with Chart do
begin
FirstVisibleDate := '9/20/2010';
LevelCount := 2;
PaneWidth[False] := 256;
with Bars.Add('Task:Split') do
begin
Shortcut := 'Task';
Def[EXG2ANTTLib_TLB.exBarKeepWorkingCount] := OleVariant(True);
end;
end;
with Items do
begin
AllowCellValueToItemBar := True;
AddBar(AddItem('M1'),'Milestone','9/24/2010','9/24/2010',Null,Null);
AddBar(AddItem('T1'),'Task','9/24/2010','9/28/2010',Null,Null);
AddBar(AddItem('T2'),'Task','9/27/2010','9/28/2010',Null,Null);
AddBar(AddItem('M3'),'Milestone','9/28/2010','9/28/2010',Null,Null);
end;
EndUpdate();
end
|
2113
|
Bars with gradient shows no border or frame arround. What can be done (method 2)
![](images/exg2anttq2113.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
Chart.FirstVisibleDate := '1/1/2001';
Chart.PaneWidth[False] := 48;
DefaultItemHeight := 24;
with Chart.Bars.Add('E1') do
begin
Color := $0;
StartColor := $ff00;
EndColor := $ffff;
Pattern := Integer(EXG2ANTTLib_TLB.exPatternGradientVBox) Or Integer(EXG2ANTTLib_TLB.exPatternBox);
Height := 20;
end;
with Chart.Bars.Add('E2') do
begin
Color := $0;
StartColor := $ff00;
EndColor := $ffff;
Pattern := Integer(EXG2ANTTLib_TLB.exPatternGradientVBox) Or Integer(EXG2ANTTLib_TLB.exPatternBox);
Height := 20;
Def[EXG2ANTTLib_TLB.exBarBackgroundExt] := '[frame=RGB(255,0,0),framethick]';
end;
with Items do
begin
AddItem(Null);
h := AddItem('no border');
AddBar(h,'E1','1/2/2001','1/8/2001','',Null);
h := AddItem('w/h boder');
AddBar(h,'E2','1/2/2001','1/8/2001','',Null);
AddItem(Null);
end;
EndUpdate();
end
|
2112
|
Bars with gradient shows no border or frame arround. What can be done (method 1)
![](images/exg2anttq2112.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
Chart.FirstVisibleDate := '1/1/2001';
Chart.PaneWidth[False] := 48;
DefaultItemHeight := 24;
with Chart.Bars.Add('E2') do
begin
Color := $0;
StartColor := $ff00;
EndColor := $ffff;
Pattern := Integer(EXG2ANTTLib_TLB.exPatternGradientVBox) Or Integer(EXG2ANTTLib_TLB.exPatternBox);
Height := 20;
end;
with Items do
begin
AddItem(Null);
h := AddItem('no border');
AddBar(h,'E2','1/2/2001','1/8/2001','',Null);
h := AddItem('w/h boder');
AddBar(h,'E2','1/2/2001','1/8/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarBackgroundExt] := '[frame=RGB(255,0,0),framethick]';
AddItem(Null);
end;
EndUpdate();
end
|
2111
|
Is it possible to display auto-numbers (rows-numbers) for non-empty items only
![](images/exg2anttq2111.png)
with G2antt1 do
begin
BeginUpdate();
Chart.PaneWidth[False] := 128;
with Columns do
begin
Add('Items');
with (IUnknown(Add('Pos')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := 'len(%C0) ? 1 pos `` : ``';
Position := 0;
end;
end;
with Items do
begin
AddItem('Item A');
AddItem('');
AddItem('Item B');
AddItem('');
AddItem('Item C');
end;
EndUpdate();
end
|
2110
|
Is it possible to separate the group of items using horizontal-lines (root-items)
![](images/exg2anttq2110.png)
with G2antt1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABLEIQAAYAQGKIcBiAKBQAGaAoDgYN4MAANAwjJBMKgBBCLIxhEYobgmGIaRiAUbQSKEPxLEiPmqSHIEWwtDiBZgieTpNhAMg1CTNU4RAKoYR' +
'zBKeZ7kGZIVjKMofURRDpxBBMAkB');
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
DefaultItemHeight := 24;
SelBackMode := EXG2ANTTLib_TLB.exTransparent;
with Chart do
begin
FirstVisibleDate := '1/1/2001';
LevelCount := 2;
PaneWidth[False] := 196;
SelBackColor := G2antt1.SelBackColor;
end;
with Columns do
begin
with (IUnknown(Add('Default')) as EXG2ANTTLib_TLB.Column) do
begin
Def[EXG2ANTTLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
with (IUnknown(Add('Position')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 + ((1 rpos ``) contains `.`)';
Visible := False;
end;
end;
with ConditionalFormats.Add('%C1',Null) do
begin
BackColor := $1000000;
ChartBackColor := BackColor;
end;
with Items do
begin
h := AddItem('Group 1');
AddBar(InsertItem(h,Null,'Child 1'),'Task','1/3/2001','1/13/2001',Null,Null);
AddBar(InsertItem(h,Null,'Child 2'),'Task','1/4/2001','1/14/2001',Null,Null);
ExpandItem[h] := True;
h := AddItem('Group 2');
AddBar(InsertItem(h,Null,'Child 1'),'Task','1/3/2001','1/13/2001',Null,Null);
AddBar(InsertItem(h,Null,'Child 2'),'Task','1/4/2001','1/14/2001',Null,Null);
end;
EndUpdate();
end
|
2109
|
How can specify a black pattern for the task
![](images/exg2anttq2109.png)
with G2antt1 do
begin
BeginUpdate();
DefaultItemHeight := 22;
with Chart do
begin
FirstVisibleDate := '1/1/2001';
LevelCount := 2;
PaneWidth[False] := 0;
end;
Columns.Add('Frames');
with Items do
begin
h := AddItem('Task');
AddBar(h,'Task','1/2/2001','1/12/2001','bar A',Null);
ItemBar[h,'bar A',EXG2ANTTLib_TLB.exBarColor] := OleVariant(1);
AddBar(h,'Task','1/14/2001','1/24/2001','bar B',Null);
end;
EndUpdate();
end
|
2108
|
Can I define a bar so it automatically fills the current item/row height (same height)
![](images/exg2anttq2108.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Task');
with Chart do
begin
LevelCount := 2;
PaneWidth[False] := 96;
FirstVisibleDate := '1/1/2001';
Bars.Item['Task'].Height := -1;
end;
with Items do
begin
AddBar(AddItem('Task A'),'Task','1/2/2001','1/5/2001',Null,Null);
h := AddItem('Task A');
AddBar(h,'Task','1/2/2001','1/5/2001','',Null);
ItemBar[h,'',EXG2ANTTLib_TLB.exBarColor] := OleVariant(255);
end;
EndUpdate();
end
|
2107
|
How can I highlight a specified date for the entire chart (Method 2)
![](images/exg2anttq2107.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 96;
UnitWidth := 18;
LevelCount := 2;
MarkTimeZone('zone1','1/8/2001','1/9/2001',OleVariant(0),Null);
MarkTimeZone('zone2','1/2/2001','1/4/2001',OleVariant(0),'50');
end;
with Items do
begin
AddItem('');
h := AddItem('Task(I)');
AddBar(h,'Task','1/5/2001','1/12/2001','I',Null);
AddItem('');
end;
EndUpdate();
end
|
2106
|
How can I highlight a specified date for the entire chart, including the header (Method 1)
![](images/exg2anttq2106.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 96;
UnitWidth := 18;
LevelCount := 2;
AllowInsideZoom := True;
AllowResizeInsideZoom := False;
InsideZoomOnDblClick := False;
with DefaultInsideZoomFormat do
begin
ForeColor := $ffffff;
BackColorChart := $10000;
BackColor := $10000;
end;
with InsideZooms do
begin
SplitBaseLevel := False;
DefaultWidth := 18;
Add('1/8/2001').AllowInsideFormat := False;
end;
end;
with Items do
begin
AddItem('');
h := AddItem('Task(I)');
AddBar(h,'Task','1/5/2001','1/12/2001','I',Null);
AddItem('');
end;
EndUpdate();
end
|
2105
|
How can I highlight a specified date of a specified item
![](images/exg2anttq2105.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 96;
UnitWidth := 18;
LevelCount := 2;
end;
with Items do
begin
AddItem('');
h := AddItem('Task(D)');
AddBar(h,'Task','1/5/2001','1/12/2001','D',Null);
AddItem('');
end;
with Chart.Notes do
begin
with Add('NoteD',OleVariant(h),'1/8/2001','<b><%dd%></b><br><%m%><br><%yy%>') do
begin
PartFixedWidth[EXG2ANTTLib_TLB.exNoteEnd] := 18;
PartShadow[EXG2ANTTLib_TLB.exNoteEnd] := False;
end;
end;
EndUpdate();
end
|
2104
|
How can I display the start/end of the task within its margins (notes)
![](images/exg2anttq2104.png)
with G2antt1 do
begin
BeginUpdate();
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '1/1/2001';
PaneWidth[False] := 96;
UnitWidth := 18;
LevelCount := 2;
end;
with Items do
begin
AddItem('');
h := AddItem('Task(T)');
AddBar(h,'Task','1/5/2001','1/12/2001','T',Null);
AddItem('');
end;
with Chart.Notes do
begin
with Add('NoteTS',OleVariant(h),'T','') do
begin
ShowLink := EXG2ANTTLib_TLB.exNoteLinkHidden;
PartText[EXG2ANTTLib_TLB.exNoteStart] := '<%d%>';
PartHOffset[EXG2ANTTLib_TLB.exNoteStart] := 9;
PartFixedWidth[EXG2ANTTLib_TLB.exNoteStart] := 18;
end;
with Add('NoteTE',OleVariant(h),'T','') do
begin
RelativePosition := 'E-1';
ShowLink := EXG2ANTTLib_TLB.exNoteLinkHidden;
PartText[EXG2ANTTLib_TLB.exNoteStart] := '<%d%>';
PartHOffset[EXG2ANTTLib_TLB.exNoteStart] := 9;
PartFixedWidth[EXG2ANTTLib_TLB.exNoteStart] := 18;
end;
end;
EndUpdate();
end
|
2103
|
Is it possible to show the tasks not-overlaid when the item is collapsed and overlaid once the user expands the item
![](images/exg2anttq2103.png)
// BeforeExpandItem event - Fired before an item is about to be expanded (collapsed).
procedure TForm1.G2antt1BeforeExpandItem(ASender: TObject; Item : HITEM;var Cancel : OleVariant);
begin
with G2antt1 do
begin
Refresh();
end
end;
with G2antt1 do
begin
BeginUpdate();
Indent := 16;
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
HasLines := EXG2ANTTLib_TLB.exSolidLine;
DrawGridLines := EXG2ANTTLib_TLB.exHLines;
Columns.Add('Tasks');
with Chart do
begin
FirstVisibleDate := '9/20/2006';
ShowCollapsedBars := True;
LevelCount := 2;
PaneWidth[False] := 128;
DrawGridLines := EXG2ANTTLib_TLB.exHLines;
with Bars.Item['Task'] do
begin
OverlaidType := EXG2ANTTLib_TLB.exOverlaidBarsStack;
Color := $0;
StartColor := $c4c4c4;
EndColor := $c4c4c4;
Pattern := EXG2ANTTLib_TLB.exPatternBox;
end;
end;
with Items do
begin
h := AddItem('Project 1');
h1 := InsertItem(h,Null,'Resources');
AddBar(h1,'Task','9/21/2006','9/25/2006','A',Null);
AddBar(h1,'Task','9/24/2006','9/28/2006','B',Null);
AddBar(h1,'Task','9/27/2006','9/29/2006','C',Null);
h := AddItem('Project 2');
h1 := InsertItem(h,Null,'Resources');
AddBar(h1,'Task','9/21/2006','9/25/2006','A',Null);
AddBar(h1,'Task','9/24/2006','9/28/2006','B',Null);
AddBar(h1,'Task','9/27/2006','9/29/2006','C',Null);
ExpandItem[h] := True;
end;
EndUpdate();
end
|
2102
|
Is it possible to display the label of the level without truncating / no clip
![](images/exg2anttq2102.png)
with G2antt1 do
begin
BeginUpdate();
with Chart do
begin
FirstWeekDay := EXG2ANTTLib_TLB.exSunday;
FirstVisibleDate := '12/31/2000';
PaneWidth[False] := 0;
LevelCount := 3;
with Level[0] do
begin
Label := OleVariant(16);
FormatLabel := '`<c>` + value';
end;
with Level[1] do
begin
Label := OleVariant(256);
FormatLabel := '`<c>` + value';
end;
with Level[2] do
begin
Alignment := EXG2ANTTLib_TLB.AlignmentEnum($100);
FormatLabel := 'weekday(dvalue) = 0 ? `<b>` + value : ``';
DrawTickLines := EXG2ANTTLib_TLB.exLevelNoLine;
DrawTickLinesFrom(1,EXG2ANTTLib_TLB.exLevelDotLine);
DrawGridLines := True;
end;
UnitWidth := 6;
DrawGridLines := EXG2ANTTLib_TLB.exAllLines;
end;
EndUpdate();
end
|
2101
|
How do I get the item's auto-number, when using FormatColumn property, as CellValue gets empty
![](images/exg2anttq2101.png)
// SelectionChanged event - Fired after a new item has been selected.
procedure TForm1.G2antt1SelectionChanged(ASender: TObject; );
begin
with G2antt1 do
begin
with Items do
begin
OutputDebugString( 'pos: ' );
OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(1)] );
OutputDebugString( 'rpos(1): ' );
OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(2)] );
OutputDebugString( 'rpos(2): ' );
OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(3)] );
OutputDebugString( 'apos: ' );
OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(4)] );
OutputDebugString( 'index: ' );
OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(5)] );
end;
end
end;
with G2antt1 do
begin
BeginUpdate();
LinesAtRoot := EXG2ANTTLib_TLB.exLinesAtRoot;
DrawGridLines := EXG2ANTTLib_TLB.exRowLines;
HeaderAppearance := EXG2ANTTLib_TLB.Etched;
with Columns do
begin
Add('Items');
with (IUnknown(Add('pos')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 pos ``';
Position := 0;
Width := 48;
AllowSizing := False;
end;
with (IUnknown(Add('rpos(1)')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 rpos ``';
Position := 1;
Width := 48;
AllowSizing := False;
end;
with (IUnknown(Add('rpos(2)')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 rpos `.||A-Z`';
Position := 2;
Width := 48;
AllowSizing := False;
end;
with (IUnknown(Add('apos')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 apos ``';
Position := 3;
Width := 48;
AllowSizing := False;
end;
with (IUnknown(Add('index')) as EXG2ANTTLib_TLB.Column) do
begin
FormatColumn := '1 index ``';
Position := 4;
Width := 48;
AllowSizing := False;
end;
end;
with Items do
begin
h := AddItem('Item 1');
InsertItem(h,Null,'Child 1');
hSel := InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
AddItem('Item 2');
AddItem('Item 3');
end;
EndUpdate();
Items.SelectItem[hSel] := True;
end
|